public static long cal ( long width , long height ) {
  if ( width * height == 0 ) {
    return - Math . max ( width , height ) ;
  }
  else if ( width == height ) {
    return width ;
  }
  else if ( width > height ) {
    return width / height * height * 2 + cal ( width % height , height ) ;
  }
  else {
    return height / width * width * 2 + cal ( width , height % width ) ;
  }
}

public static long cal ( long width , long height ) { if ( width * height == 0 ) { return - Math . max ( width , height ) ; } else if ( width == height ) { return width ; } else if ( width > height ) { return width / height * height * 2 + cal ( width % height , height ) ; } else { return height / width * width * 2 + cal ( width , height % width ) ; } }
(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))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))) consequence: (block (return_statement (unary_expression operand: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier)))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (return_statement (identifier))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (return_statement (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier)) right: (decimal_integer_literal)) right: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier)) (identifier)))))) alternative: (block (return_statement (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier)) right: (decimal_integer_literal)) right: (method_invocation name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (identifier) right: (identifier))))))))))))