public static void main ( String ards [ ] ) {
  Scanner cin = new Scanner ( System . in ) ;
  while ( cin . hasNext ( ) ) {
    long n = cin . nextLong ( ) ;
    long m = cin . nextLong ( ) ;
    if ( n > m ) {
      long x = n ;
      n = m ;
      m = x ;
    }
    if ( n == 1 ) {
      if ( m % 6 == 0 ) System . out . println ( m ) ;
      else if ( m % 6 <= 3 ) System . out . println ( m - ( m % 6 ) ) ;
      else System . out . println ( m - ( 6 - m % 6 ) ) ;
    }
    else if ( n == 2 && m == 2 ) System . out . println ( 0 ) ;
    else if ( n == 2 && m == 3 ) System . out . println ( 4 ) ;
    else if ( n == 2 && m == 7 ) System . out . println ( 12 ) ;
    else {
      if ( n % 2 == 1 && m % 2 == 1 ) System . out . println ( n * m - 1 ) ;
      else System . out . println ( n * m ) ;
    }
  }
}

public static void main ( String ards [ ] ) { Scanner cin = new Scanner ( System . in ) ; while ( cin . hasNext ( ) ) { long n = cin . nextLong ( ) ; long m = cin . nextLong ( ) ; if ( n > m ) { long x = n ; n = m ; m = x ; } if ( n == 1 ) { if ( m % 6 == 0 ) System . out . println ( m ) ; else if ( m % 6 <= 3 ) System . out . println ( m - ( m % 6 ) ) ; else System . out . println ( m - ( 6 - m % 6 ) ) ; } else if ( n == 2 && m == 2 ) System . out . println ( 0 ) ; else if ( n == 2 && m == 3 ) System . out . println ( 4 ) ; else if ( n == 2 && m == 7 ) System . out . println ( 12 ) ; else { if ( n % 2 == 1 && m % 2 == 1 ) System . out . println ( n * m - 1 ) ; else System . out . println ( n * m ) ; } } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier) dimensions: (dimensions))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (while_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) (expression_statement (assignment_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 (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier)))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))))))) alternative: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (decimal_integer_literal) right: (binary_expression left: (identifier) right: (decimal_integer_literal))))))))))) alternative: (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: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (decimal_integer_literal)))) alternative: (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: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (decimal_integer_literal)))) alternative: (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: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (decimal_integer_literal)))) alternative: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)) right: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)))) consequence: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))))) alternative: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier)))))))))))))))