public static void solve ( ) {
  Scanner sc = new Scanner ( System . in ) ;
  int n = sc . nextInt ( ) ;
  int m = sc . nextInt ( ) ;
  long ans = 1 ;
  long mod = ( long ) Math . pow ( 10 , 9 ) + 7 ;
  if ( n == m ) {
    for ( int i = n ;
    i > 0 ;
    i -- ) {
      ans = ( ( ans * ( long ) i ) % mod ) * ( long ) i % mod ;
    }
    ans = ( ans * 2 ) % mod ;
  }
  else if ( ( int ) Math . abs ( n - m ) == 1 ) {
    for ( int i = ( int ) Math . min ( n , m ) ;
    i > 0 ;
    i -- ) {
      ans = ( ( ans * ( long ) i ) % mod ) * ( long ) i % mod ;
    }
    ans = ( ans * ( long ) Math . max ( n , m ) ) % mod ;
  }
  else {
    ans = 0 ;
  }
  System . out . println ( ans ) ;
}

public static void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; long ans = 1 ; long mod = ( long ) Math . pow ( 10 , 9 ) + 7 ; if ( n == m ) { for ( int i = n ; i > 0 ; i -- ) { ans = ( ( ans * ( long ) i ) % mod ) * ( long ) i % mod ; } ans = ( ans * 2 ) % mod ; } else if ( ( int ) Math . abs ( n - m ) == 1 ) { for ( int i = ( int ) Math . min ( n , m ) ; i > 0 ; i -- ) { ans = ( ( ans * ( long ) i ) % mod ) * ( long ) i % mod ; } ans = ( ans * ( long ) Math . max ( n , m ) ) % mod ; } else { ans = 0 ; } System . out . println ( ans ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters) 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)))))) (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)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (cast_expression type: (integral_type) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (decimal_integer_literal)))) right: (decimal_integer_literal)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (cast_expression type: (integral_type) value: (identifier)))) right: (identifier))) right: (cast_expression type: (integral_type) value: (identifier))) right: (identifier)))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (identifier))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (cast_expression type: (integral_type) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier))))) right: (decimal_integer_literal))) consequence: (block (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (cast_expression type: (integral_type) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier)))))) condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (cast_expression type: (integral_type) value: (identifier)))) right: (identifier))) right: (cast_expression type: (integral_type) value: (identifier))) right: (identifier)))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (cast_expression type: (integral_type) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier)))))) right: (identifier))))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal)))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))