# 2019/08/08



from math import factorial



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

diff=abs(n-m)

if diff>1:ans=0

elif diff==0:

    res=factorial(n)

    ans=2*res%(10**9+7)*res%(10**9+7)

else:

    ans=factorial(n)%(10**9+7)*factorial(m)%(10**9+7)

print(ans)
# 2019/08/08

# 高速改良版



def mod(n):

    return n%(10**9+7)



def fac(n):

    res=1

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

        res=mod(res*i)

    return res



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

diff=abs(n-m)

if diff>1:ans=0

elif diff==0:

    ans=mod(2*fac(n)*fac(m))

else:

    ans=mod(fac(n)*fac(m))

print(ans)
# 2019/08/08
from math import factorial

n, m = list(map(int, input().split()))
diff = abs(n - m)
if diff > 1:
    ans = 0
elif diff == 0:
    res = factorial(n)
    ans = 2 * res % (10**9 + 7) * res % (10**9 + 7)
else:
    ans = factorial(n) % (10**9 + 7) * factorial(m) % (10**9 + 7)
print(ans)

# 2019/08/08
# 高速改良版
def mod(n):
    return n % (10**9 + 7)


def fac(n):
    res = 1
    for i in range(1, n + 1):
        res = mod(res * i)
    return res


n, m = list(map(int, input().split()))
diff = abs(n - m)
if diff > 1:
    ans = 0
elif diff == 0:
    ans = mod(2 * fac(n) * fac(m))
else:
    ans = mod(fac(n) * fac(m))
print(ans)

-from math import factorial +# 高速改良版 +def mod(n): +    return n % (10**9 + 7) + + +def fac(n): +    res = 1 +    for i in range(1, n + 1): +        res = mod(res * i) +    return res + -    res = factorial(n) -    ans = 2 * res % (10**9 + 7) * res % (10**9 + 7) +    ans = mod(2 * fac(n) * fac(m)) -    ans = factorial(n) % (10**9 + 7) * factorial(m) % (10**9 + 7) +    ans = mod(fac(n) * fac(m))