public static void process ( ) throws IOException {
  long x = sc . nextLong ( ) , y = sc . nextLong ( ) , a = sc . nextLong ( ) , b = sc . nextLong ( ) ;
  long l = 0 , r = Integer . MAX_VALUE ;
  while ( l <= r ) {
    long mid = ( l + r ) / 2 ;
    long curr = mid * a + x ;
    long other = y - mid * b ;
    if ( curr > other ) {
      r = mid - 1 ;
    }
    else if ( curr < other ) {
      l = mid + 1 ;
    }
    else {
      System . out . println ( mid ) ;
      return ;
    }
  }
  System . out . println ( - 1 ) ;
}

public static void process ( ) throws IOException { long x = sc . nextLong ( ) , y = sc . nextLong ( ) , a = sc . nextLong ( ) , b = sc . nextLong ( ) ; long l = 0 , r = Integer . MAX_VALUE ; while ( l <= r ) { long mid = ( l + r ) / 2 ; long curr = mid * a + x ; long other = y - mid * b ; if ( curr > other ) { r = mid - 1 ; } else if ( curr < other ) { l = mid + 1 ; } else { System . out . println ( mid ) ; return ; } } System . out . println ( - 1 ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters) (throws (type_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))) 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: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (parenthesized_expression (binary_expression left: (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: (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal))))) alternative: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier)))) (return_statement)))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (unary_expression operand: (decimal_integer_literal)))))))