public static void main ( String [ ] $ ) {
  int n = scanner . nextInt ( ) , m = scanner . nextInt ( ) ;
  int x = scanner . nextInt ( ) , y = scanner . nextInt ( ) ;
  int [ ] a = java . util . stream . IntStream . range ( 0 , n ) . map ( i -> scanner . nextInt ( ) ) . toArray ( ) ;
  int [ ] b = java . util . stream . IntStream . range ( 0 , m ) . map ( i -> scanner . nextInt ( ) ) . toArray ( ) ;
  int i = 0 , j = 0 , t = 1 , ans = 0 ;
  loop : while ( i < n && j < m ) {
    while ( a [ i ] < t ) if ( ++ i == n ) break loop ;
    t = a [ i ] + x ;
    while ( b [ j ] < t ) if ( ++ j == m ) break loop ;
    t = b [ j ] + y ;
    ans ++ ;
  }
  System . out . println ( ans ) ;
}

public static void main ( String [ ] $ ) { int n = scanner . nextInt ( ) , m = scanner . nextInt ( ) ; int x = scanner . nextInt ( ) , y = scanner . nextInt ( ) ; int [ ] a = java . util . stream . IntStream . range ( 0 , n ) . map ( i -> scanner . nextInt ( ) ) . toArray ( ) ; int [ ] b = java . util . stream . IntStream . range ( 0 , m ) . map ( i -> scanner . nextInt ( ) ) . toArray ( ) ; int i = 0 , j = 0 , t = 1 , ans = 0 ; loop : while ( i < n && j < m ) { while ( a [ i ] < t ) if ( ++ i == n ) break loop ; t = a [ i ] + x ; while ( b [ j ] < t ) if ( ++ j == m ) break loop ; t = b [ j ] + y ; ans ++ ; } System . out . println ( ans ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (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: (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: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (method_invocation object: (method_invocation object: (field_access object: (field_access object: (field_access object: (identifier) field: (identifier)) field: (identifier)) field: (identifier)) name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier))) name: (identifier) arguments: (argument_list (lambda_expression parameters: (identifier) body: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (method_invocation object: (method_invocation object: (field_access object: (field_access object: (field_access object: (identifier) field: (identifier)) field: (identifier)) field: (identifier)) name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier))) name: (identifier) arguments: (argument_list (lambda_expression parameters: (identifier) body: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (labeled_statement (identifier) (while_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (identifier) right: (identifier)))) body: (block (while_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))) body: (if_statement condition: (parenthesized_expression (binary_expression left: (update_expression (identifier)) right: (identifier))) consequence: (break_statement (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier)))) (while_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))) body: (if_statement condition: (parenthesized_expression (binary_expression left: (update_expression (identifier)) right: (identifier))) consequence: (break_statement (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier)))) (expression_statement (update_expression (identifier)))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))