public static String exec ( ) {
  int a = sc . nextInt ( ) ;
  int b = sc . nextInt ( ) ;
  BigDecimal [ ] bd = new BigDecimal [ a ] ;
  for ( int i = 0 ;
  i < a ;
  i ++ ) bd [ i ] = new BigDecimal ( sc . next ( ) ) ;
  BigDecimal [ ] rs = new BigDecimal [ a + 2 ] ;
  rs [ 0 ] = new BigDecimal ( b + 2 ) ;
  int backspacesNeeded = a ;
  double runningChance = 1.0 ;
  for ( int i = 0 ;
  i < a ;
  i ++ ) {
    int charsNeededOnSuccess = backspacesNeeded + b - i + 1 ;
    int charsNeededOnFail = charsNeededOnSuccess + b + 1 ;
    double onSuccess = runningChance * charsNeededOnSuccess ;
    double onFail = ( 1.0 - runningChance ) * charsNeededOnFail ;
    rs [ i + 1 ] = new BigDecimal ( onSuccess + onFail ) ;
    runningChance *= bd [ i ] . doubleValue ( ) ;
    backspacesNeeded -- ;
  }
  rs [ a + 1 ] = new BigDecimal ( ( runningChance * ( b - a + 1 ) ) + ( ( 1.0 - runningChance ) * ( b - a + 1 + b + 1 ) ) ) ;
  Arrays . sort ( rs ) ;
  BigDecimal result = rs [ 0 ] ;
  return String . format ( "%.06f" , result ) ;
}

public static String exec ( ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; BigDecimal [ ] bd = new BigDecimal [ a ] ; for ( int i = 0 ; i < a ; i ++ ) bd [ i ] = new BigDecimal ( sc . next ( ) ) ; BigDecimal [ ] rs = new BigDecimal [ a + 2 ] ; rs [ 0 ] = new BigDecimal ( b + 2 ) ; int backspacesNeeded = a ; double runningChance = 1.0 ; for ( int i = 0 ; i < a ; i ++ ) { int charsNeededOnSuccess = backspacesNeeded + b - i + 1 ; int charsNeededOnFail = charsNeededOnSuccess + b + 1 ; double onSuccess = runningChance * charsNeededOnSuccess ; double onFail = ( 1.0 - runningChance ) * charsNeededOnFail ; rs [ i + 1 ] = new BigDecimal ( onSuccess + onFail ) ; runningChance *= bd [ i ] . doubleValue ( ) ; backspacesNeeded -- ; } rs [ a + 1 ] = new BigDecimal ( ( runningChance * ( b - a + 1 ) ) + ( ( 1.0 - runningChance ) * ( b - a + 1 + b + 1 ) ) ) ; Arrays . sort ( rs ) ; BigDecimal result = rs [ 0 ] ; return String . format ( " % .06f " , result ) ; }
(method_declaration (modifiers) type: (type_identifier) name: (identifier) parameters: (formal_parameters) body: (block (local_variable_declaration type: (integral_type) 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)))) (local_variable_declaration type: (array_type element: (type_identifier) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (type_identifier) dimensions: (dimensions_expr (identifier))))) (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: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (object_creation_expression type: (type_identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))))) (local_variable_declaration type: (array_type element: (type_identifier) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (type_identifier) dimensions: (dimensions_expr (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (object_creation_expression type: (type_identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (decimal_floating_point_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 (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier)) right: (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)))) (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (identifier)))) (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (parenthesized_expression (binary_expression left: (decimal_floating_point_literal) right: (identifier))) right: (identifier)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (object_creation_expression type: (type_identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier)))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (array_access array: (identifier) index: (identifier)) name: (identifier) arguments: (argument_list)))) (expression_statement (update_expression (identifier))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (object_creation_expression type: (type_identifier) arguments: (argument_list (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))))) right: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (decimal_floating_point_literal) right: (identifier))) right: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)) right: (identifier)) right: (decimal_integer_literal)))))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (array_access array: (identifier) index: (decimal_integer_literal)))) (return_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal) (identifier))))))