static int val ( int r , int c , int n ) {
  if ( r == 1 ) return special ( c , n ) ;
  if ( c == 1 ) return special ( r , n ) ;
  if ( ( r * c ) % 2 == 0 ) return thing ( r , c , n , r * c / 2 , 2 , r + c - 4 ) ;
  else return Math . min ( thing ( r , c , n , r * c / 2 + 1 , 0 , r + c - 2 ) , thing ( r , c , n , r * c / 2 , 4 , r + c - 6 ) ) ;
}

static int val ( int r , int c , int n ) { if ( r == 1 ) return special ( c , n ) ; if ( c == 1 ) return special ( r , n ) ; if ( ( r * c ) % 2 == 0 ) return thing ( r , c , n , r * c / 2 , 2 , r + c - 4 ) ; else return Math . min ( thing ( r , c , n , r * c / 2 + 1 , 0 , r + c - 2 ) , thing ( r , c , n , r * c / 2 , 4 , r + c - 6 ) ) ; }
(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))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (return_statement (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (return_statement (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (return_statement (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier) (identifier) (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)) (decimal_integer_literal) (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))))) alternative: (return_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier) (identifier) (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)) right: (decimal_integer_literal)) (decimal_integer_literal) (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)))) (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier) (identifier) (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)) (decimal_integer_literal) (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))))))))))