public static void main ( String [ ] args ) throws Exception {
  Scanner s = new Scanner ( new File ( "A.in" ) ) ;
  PrintWriter out = new PrintWriter ( new File ( "A.out" ) ) ;
  int T = s . nextInt ( ) ;
  for ( int tc = 1 ;
  tc <= T ;
  tc ++ ) {
    out . print ( "Case #" + tc + ": " ) ;
    int A = s . nextInt ( ) , B = s . nextInt ( ) ;
    double best = A + B + 1 ;
    logP [ 0 ] = Math . log ( s . nextDouble ( ) ) ;
    best = Math . min ( best , ( 2 * ( A - 1 ) + ( B - A ) + 1 ) + ( B + 1 ) - ( B + 1 ) * Math . exp ( logP [ 0 ] ) ) ;
    for ( int i = 1 ;
    i < A ;
    i ++ ) {
      logP [ i ] = logP [ i - 1 ] + Math . log ( s . nextDouble ( ) ) ;
      best = Math . min ( best , ( 2 * ( A - 1 - i ) + ( B - A ) + 1 ) + ( B + 1 ) - ( B + 1 ) * Math . exp ( logP [ i ] ) ) ;
    }
    best = Math . min ( best , B + 2 ) ;
    out . println ( best ) ;
  }
  out . close ( ) ;
}

public static void main ( String [ ] args ) throws Exception { Scanner s = new Scanner ( new File ( " A . in " ) ) ; PrintWriter out = new PrintWriter ( new File ( " A . out " ) ) ; int T = s . nextInt ( ) ; for ( int tc = 1 ; tc <= T ; tc ++ ) { out . print ( " Case ▁ # " + tc + " : ▁ " ) ; int A = s . nextInt ( ) , B = s . nextInt ( ) ; double best = A + B + 1 ; logP [ 0 ] = Math . log ( s . nextDouble ( ) ) ; best = Math . min ( best , ( 2 * ( A - 1 ) + ( B - A ) + 1 ) + ( B + 1 ) - ( B + 1 ) * Math . exp ( logP [ 0 ] ) ) ; for ( int i = 1 ; i < A ; i ++ ) { logP [ i ] = logP [ i - 1 ] + Math . log ( s . nextDouble ( ) ) ; best = Math . min ( best , ( 2 * ( A - 1 - i ) + ( B - A ) + 1 ) + ( B + 1 ) - ( B + 1 ) * Math . exp ( logP [ i ] ) ) ; } best = Math . min ( best , B + 2 ) ; out . println ( best ) ; } out . close ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) (throws (type_identifier)) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (object_creation_expression type: (type_identifier) arguments: (argument_list (string_literal))))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (object_creation_expression type: (type_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)))) (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 (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (string_literal) right: (identifier)) right: (string_literal))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (decimal_integer_literal) right: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (parenthesized_expression (binary_expression left: (identifier) right: (identifier)))) right: (decimal_integer_literal))) right: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (decimal_integer_literal)))))))))) (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 (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (decimal_integer_literal) right: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (identifier)))) right: (parenthesized_expression (binary_expression left: (identifier) right: (identifier)))) right: (decimal_integer_literal))) right: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier)))))))))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))