from math import factorial

MOD = 10**9+7

N,M = list(map(int,input().split()))

ans = 0

if abs(N-M) > 1:

    pass

elif abs(N-M) ==1:

    ans = factorial(N)*factorial(M) % MOD

elif N==M:

    ans = 2*factorial(N)*factorial(M) % MOD



print(ans)
from math import factorial

MOD = 10**9+7

N,M = list(map(int,input().split()))

ans = 0

if abs(N-M) > 1:

    pass

elif abs(N-M) ==1:

    ans = (factorial(N) % MOD * factorial(M) % MOD) % MOD

elif N==M:

    ans = ( 2 * factorial(N) % MOD * factorial(M) % MOD) % MOD



print(ans)
from math import factorial

MOD = 10**9 + 7
N, M = list(map(int, input().split()))
ans = 0
if abs(N - M) > 1:
    pass
elif abs(N - M) == 1:
    ans = factorial(N) * factorial(M) % MOD
elif N == M:
    ans = 2 * factorial(N) * factorial(M) % MOD
print(ans)

from math import factorial

MOD = 10**9 + 7
N, M = list(map(int, input().split()))
ans = 0
if abs(N - M) > 1:
    pass
elif abs(N - M) == 1:
    ans = (factorial(N) % MOD * factorial(M) % MOD) % MOD
elif N == M:
    ans = (2 * factorial(N) % MOD * factorial(M) % MOD) % MOD
print(ans)

-    ans = factorial(N) * factorial(M) % MOD +    ans = (factorial(N) % MOD * factorial(M) % MOD) % MOD -    ans = 2 * factorial(N) * factorial(M) % MOD +    ans = (2 * factorial(N) % MOD * factorial(M) % MOD) % MOD