import math

n, m = list(map(int,input().split()))



sum = 0

if -2<n-m<2:

    if n<m:

        n,m = m,n

    sum = math.factorial(n)*math.factorial(m)*2**(m-n+1)

    sum %= 1000000007

print(sum)
n, m = list(map(int,input().split()))

MOD = 1000000007



def f(n):

    ans = 1

    for i in range(1,n+1):

        ans*=i

        ans%=MOD

    return ans



sum = 0

if -2<n-m<2:

    if n<m:

        n,m = m,n

    sum = f(n)*f(m)*2**(m-n+1)

    sum %= MOD

print(sum)

import math

n, m = list(map(int, input().split()))
sum = 0
if -2 < n - m < 2:
    if n < m:
        n, m = m, n
    sum = math.factorial(n) * math.factorial(m) * 2 ** (m - n + 1)
    sum %= 1000000007
print(sum)

n, m = list(map(int, input().split()))
MOD = 1000000007


def f(n):
    ans = 1
    for i in range(1, n + 1):
        ans *= i
        ans %= MOD
    return ans


sum = 0
if -2 < n - m < 2:
    if n < m:
        n, m = m, n
    sum = f(n) * f(m) * 2 ** (m - n + 1)
    sum %= MOD
print(sum)

-import math +n, m = list(map(int, input().split())) +MOD = 1000000007 -n, m = list(map(int, input().split())) + +def f(n): +    ans = 1 +    for i in range(1, n + 1): +        ans *= i +        ans %= MOD +    return ans + + -    sum = math.factorial(n) * math.factorial(m) * 2 ** (m - n + 1) -    sum %= 1000000007 +    sum = f(n) * f(m) * 2 ** (m - n + 1) +    sum %= MOD