public static void main ( String args [ ] ) throws Exception {
  Scanner in = new Scanner ( new File ( "B-large.in" ) ) ;
  PrintStream out = new PrintStream ( new File ( "B-large.out" ) ) ;
  int cas = in . nextInt ( ) ;
  for ( int iii = 0 ;
  iii < cas ;
  iii ++ ) {
    int N = in . nextInt ( ) ;
    int K = in . nextInt ( ) ;
    int B = in . nextInt ( ) ;
    int T = in . nextInt ( ) ;
    int pos [ ] = new int [ N ] ;
    int speed [ ] = new int [ N ] ;
    for ( int i = 0 ;
    i < N ;
    i ++ ) pos [ i ] = B - in . nextInt ( ) ;
    for ( int i = 0 ;
    i < N ;
    i ++ ) speed [ i ] = in . nextInt ( ) ;
    for ( int i = 0 ;
    i < N ;
    i ++ ) pos [ i ] = ( ( pos [ i ] - 1 ) / speed [ i ] ) + 1 ;
    int count = 0 ;
    int seen = 0 ;
    int done = 0 ;
    for ( int i = N - 1 ;
    i >= 0 ;
    i -- ) {
      if ( pos [ i ] > T ) {
        seen ++ ;
      }
      else {
        count += seen ;
        done ++ ;
        if ( done == K ) break ;
      }
    }
    out . println ( "Case #" + ( iii + 1 ) + ": " + ( done >= K ? "" + count : "IMPOSSIBLE" ) ) ;
  }
  out . close ( ) ;
}

public static void main ( String args [ ] ) throws Exception { Scanner in = new Scanner ( new File ( " B - large . in " ) ) ; PrintStream out = new PrintStream ( new File ( " B - large . out " ) ) ; int cas = in . nextInt ( ) ; for ( int iii = 0 ; iii < cas ; iii ++ ) { int N = in . nextInt ( ) ; int K = in . nextInt ( ) ; int B = in . nextInt ( ) ; int T = in . nextInt ( ) ; int pos [ ] = new int [ N ] ; int speed [ ] = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) pos [ i ] = B - in . nextInt ( ) ; for ( int i = 0 ; i < N ; i ++ ) speed [ i ] = in . nextInt ( ) ; for ( int i = 0 ; i < N ; i ++ ) pos [ i ] = ( ( pos [ i ] - 1 ) / speed [ i ] ) + 1 ; int count = 0 ; int seen = 0 ; int done = 0 ; for ( int i = N - 1 ; i >= 0 ; i -- ) { if ( pos [ i ] > T ) { seen ++ ; } else { count += seen ; done ++ ; if ( done == K ) break ; } } out . println ( " Case ▁ # " + ( iii + 1 ) + " : ▁ " + ( done >= K ? " " + count : " IMPOSSIBLE " ) ) ; } out . close ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier) dimensions: (dimensions))) (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 (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: (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: (integral_type) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_creation_expression type: (integral_type) 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: (binary_expression left: (identifier) right: (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: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (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: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (binary_expression left: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))) right: (array_access array: (identifier) index: (identifier)))) right: (decimal_integer_literal))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))) consequence: (block (expression_statement (update_expression (identifier)))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (update_expression (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (break_statement)))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (binary_expression left: (string_literal) right: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (string_literal)) right: (parenthesized_expression (ternary_expression condition: (binary_expression left: (identifier) right: (identifier)) consequence: (binary_expression left: (string_literal) right: (identifier)) alternative: (string_literal))))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))