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

if abs(N-M)>1:

    print((0))

    quit()

if abs(N-M)==1:

    a=1

else:

    a=2

MOD=10**9+7

def factorials(M):#M!までのリストｘと其の逆元のリストyを返すmod INF

    INF=int(1e9+7)

    fac=[0]*(M+1)

    finv=[0]*(M+1)

    inv=[0]*(M+1)

    fac[0]=fac[1]=1

    finv[0]=finv[1]=1

    inv[1]=1

    for i in range(2,M+1):

        fac[i]=(fac[i-1]*i)%INF

        inv[i]=INF-(inv[INF%i]*(INF//i))%INF

        finv[i]=finv[i-1]*inv[i]%INF

    return fac,finv

def nCr(n,r):

    INF=int(1e9+7)

    if n<r or r<0 or n<0 :

        return 0

    return fac[n]*(finv[r]*finv[n-r]%INF)%INF



fac,finv=factorials(max(N,M))



print(((a*fac[N]*fac[M])%MOD))

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

MOD=10**9+7

if abs(N-M)>=2:

    print((0))

    quit()

if abs(N-M)==1:

    a=1

else:

    a=2

def factorials(M):#M!までのリストｘと其の逆元のリストyを返すmod INF

    INF=int(1e9+7)

    fac=[0]*(M+1)

    finv=[0]*(M+1)

    inv=[0]*(M+1)

    fac[0]=fac[1]=1

    finv[0]=finv[1]=1

    inv[1]=1

    for i in range(2,M+1):

        fac[i]=(fac[i-1]*i)%INF

        inv[i]=INF-(inv[INF%i]*(INF//i))%INF

        finv[i]=finv[i-1]*inv[i]%INF

    return fac,finv

fac,finv=factorials(max(N,M))

print(((a*fac[N]*fac[M])%MOD))

N, M = list(map(int, input().split()))
if abs(N - M) > 1:
    print((0))
    quit()
if abs(N - M) == 1:
    a = 1
else:
    a = 2
MOD = 10**9 + 7


def factorials(M):  # M!までのリストｘと其の逆元のリストyを返すmod INF
    INF = int(1e9 + 7)
    fac = [0] * (M + 1)
    finv = [0] * (M + 1)
    inv = [0] * (M + 1)
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, M + 1):
        fac[i] = (fac[i - 1] * i) % INF
        inv[i] = INF - (inv[INF % i] * (INF // i)) % INF
        finv[i] = finv[i - 1] * inv[i] % INF
    return fac, finv


def nCr(n, r):
    INF = int(1e9 + 7)
    if n < r or r < 0 or n < 0:
        return 0
    return fac[n] * (finv[r] * finv[n - r] % INF) % INF


fac, finv = factorials(max(N, M))
print(((a * fac[N] * fac[M]) % MOD))

N, M = list(map(int, input().split()))
MOD = 10**9 + 7
if abs(N - M) >= 2:
    print((0))
    quit()
if abs(N - M) == 1:
    a = 1
else:
    a = 2


def factorials(M):  # M!までのリストｘと其の逆元のリストyを返すmod INF
    INF = int(1e9 + 7)
    fac = [0] * (M + 1)
    finv = [0] * (M + 1)
    inv = [0] * (M + 1)
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, M + 1):
        fac[i] = (fac[i - 1] * i) % INF
        inv[i] = INF - (inv[INF % i] * (INF // i)) % INF
        finv[i] = finv[i - 1] * inv[i] % INF
    return fac, finv


fac, finv = factorials(max(N, M))
print(((a * fac[N] * fac[M]) % MOD))

-if abs(N - M) > 1: +MOD = 10**9 + 7 +if abs(N - M) >= 2: -MOD = 10**9 + 7 -def nCr(n, r): -    INF = int(1e9 + 7) -    if n < r or r < 0 or n < 0: -        return 0 -    return fac[n] * (finv[r] * finv[n - r] % INF) % INF - -