static long solve ( long r , long c ) {
  if ( r < 3 && c < 3 ) return 0 ;
  if ( r == 1 ) {
    long res = c ;
    long m = c % 6 ;
    if ( m != 0 ) {
      if ( m <= 3 ) res -= m ;
      if ( m == 4 ) res -= 2 ;
      if ( m == 5 ) res -= 1 ;
    }
    return res ;
  }
  if ( r == 2 ) {
    if ( c == 3 || c == 7 ) return r * ( c - 1 ) ;
    return r * c ;
  }
  long res = r * c ;
  if ( res % 2 == 0 ) return res ;
  return res - 1 ;
}

static long solve ( long r , long c ) { if ( r < 3 && c < 3 ) return 0 ; if ( r == 1 ) { long res = c ; long m = c % 6 ; if ( m != 0 ) { if ( m <= 3 ) res -= m ; if ( m == 4 ) res -= 2 ; if ( m == 5 ) res -= 1 ; } return res ; } if ( r == 2 ) { if ( c == 3 || c == 7 ) return r * ( c - 1 ) ; return r * c ; } long res = r * c ; if ( res % 2 == 0 ) return res ; return res - 1 ; }
(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: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (return_statement (decimal_integer_literal))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal)))))) (return_statement (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (return_statement (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (return_statement (binary_expression left: (identifier) right: (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (return_statement (identifier))) (return_statement (binary_expression left: (identifier) right: (decimal_integer_literal)))))