public static void solve ( int n , int m , int x , int y , int a , int b ) {
  int k , g ;
  int x1 , y1 , x2 , y2 ;
  g = gcd ( a , b ) ;
  a /= g ;
  b /= g ;
  k = Math . min ( n / a , m / b ) ;
  x1 = x - ( k * a - k * a / 2 ) ;
  x2 = x + k * a / 2 ;
  y1 = y - ( k * b - k * b / 2 ) ;
  y2 = y + k * b / 2 ;
  if ( x1 < 0 ) {
    x2 -= x1 ;
    x1 = 0 ;
  }
  if ( x2 > n ) {
    x1 -= x2 - n ;
    x2 = n ;
  }
  if ( y1 < 0 ) {
    y2 -= y1 ;
    y1 = 0 ;
  }
  if ( y2 > m ) {
    y1 -= y2 - m ;
    y2 = m ;
  }
  System . out . println ( x1 + " " + y1 + " " + x2 + " " + y2 ) ;
}

public static void solve ( int n , int m , int x , int y , int a , int b ) { int k , g ; int x1 , y1 , x2 , y2 ; g = gcd ( a , b ) ; a /= g ; b /= g ; k = Math . min ( n / a , m / b ) ; x1 = x - ( k * a - k * a / 2 ) ; x2 = x + k * a / 2 ; y1 = y - ( k * b - k * b / 2 ) ; y2 = y + k * b / 2 ; if ( x1 < 0 ) { x2 -= x1 ; x1 = 0 ; } if ( x2 > n ) { x1 -= x2 - n ; x2 = n ; } if ( y1 < 0 ) { y2 -= y1 ; y1 = 0 ; } if ( y2 > m ) { y1 -= y2 - m ; y2 = m ; } System . out . println ( x1 + " ▁ " + y1 + " ▁ " + x2 + " ▁ " + y2 ) ; }
(method_declaration (modifiers) type: (void_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 (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (identifier))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier)) (binary_expression left: (identifier) right: (identifier)))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))))) (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: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))))) (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: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (identifier))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (string_literal)) right: (identifier)) right: (string_literal)) right: (identifier)) right: (string_literal)) right: (identifier)))))))