public static void main ( String args [ ] ) {
  Scanner sc = new Scanner ( System . in ) ;
  int t = sc . nextInt ( ) ;
  for ( int t1 = 1 ;
  t1 <= t ;
  t1 ++ ) {
    int n = sc . nextInt ( ) ;
    sc . nextLine ( ) ;
    String s = sc . nextLine ( ) ;
    int idx1 = s . indexOf ( "1" ) ;
    int idx2 = s . lastIndexOf ( "1" ) ;
    if ( idx2 == - 1 ) {
      System . out . println ( n ) ;
      continue ;
    }
    if ( idx2 == n - 1 || idx1 == 0 ) {
      System . out . println ( n * 2 ) ;
      continue ;
    }
    if ( idx1 == idx2 ) {
      int diff = n - idx2 ;
      if ( idx1 + 1 >= diff ) {
        System . out . println ( ( idx1 + 1 ) * 2 ) ;
        continue ;
      }
      else {
        System . out . println ( ( diff ) * 2 ) ;
        continue ;
      }
    }
    int diff = n - idx1 ;
    if ( diff >= idx2 + 1 ) {
      System . out . println ( ( diff ) * 2 ) ;
      continue ;
    }
    else {
      System . out . println ( ( idx2 + 1 ) * 2 ) ;
      continue ;
    }
  }
  sc . close ( ) ;
}

public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; for ( int t1 = 1 ; t1 <= t ; t1 ++ ) { int n = sc . nextInt ( ) ; sc . nextLine ( ) ; String s = sc . nextLine ( ) ; int idx1 = s . indexOf ( "1" ) ; int idx2 = s . lastIndexOf ( "1" ) ; if ( idx2 == - 1 ) { System . out . println ( n ) ; continue ; } if ( idx2 == n - 1 || idx1 == 0 ) { System . out . println ( n * 2 ) ; continue ; } if ( idx1 == idx2 ) { int diff = n - idx2 ; if ( idx1 + 1 >= diff ) { System . out . println ( ( idx1 + 1 ) * 2 ) ; continue ; } else { System . out . println ( ( diff ) * 2 ) ; continue ; } } int diff = n - idx1 ; if ( diff >= idx2 + 1 ) { System . out . println ( ( diff ) * 2 ) ; continue ; } else { System . out . println ( ( idx2 + 1 ) * 2 ) ; continue ; } } sc . close ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier) dimensions: (dimensions))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (unary_expression operand: (decimal_integer_literal)))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier)))) (continue_statement))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal))))) (continue_statement))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (identifier))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal))))) (continue_statement)) alternative: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (parenthesized_expression (identifier)) right: (decimal_integer_literal))))) (continue_statement))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (parenthesized_expression (identifier)) right: (decimal_integer_literal))))) (continue_statement)) alternative: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal))))) (continue_statement))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))