private static int sol ( int n , int m , int i , int j , int a , int b ) {
  if ( i == n && m == j ) return 0 ;
  int x = Math . abs ( n - i ) ;
  int y = Math . abs ( m - j ) ;
  if ( x % a == 0 && y % b == 0 ) {
    if ( ( x / a ) % 2 == ( y / b ) % 2 ) {
      x = x / a ;
      y = y / b ;
      return Math . max ( x , y ) ;
    }
  }
  return Integer . MAX_VALUE ;
}

private static int sol ( int n , int m , int i , int j , int a , int b ) { if ( i == n && m == j ) return 0 ; int x = Math . abs ( n - i ) ; int y = Math . abs ( m - j ) ; if ( x % a == 0 && y % b == 0 ) { if ( ( x / a ) % 2 == ( y / b ) % 2 ) { x = x / a ; y = y / b ; return Math . max ( x , y ) ; } } return Integer . MAX_VALUE ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (identifier) right: (identifier)))) consequence: (return_statement (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)) right: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)))) consequence: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (decimal_integer_literal)) right: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (decimal_integer_literal)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier)))) (return_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier)))))))) (return_statement (field_access object: (identifier) field: (identifier)))))