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

abs_NM=abs(N-M)

if abs_NM>1:

    print((0))

    exit()



p=10**9+7

ans=1

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

    ans=(ans*i)%p

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

    ans=(ans*i)%p

if abs_NM==0:

    ans=(ans*2)%p



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

abs_NM=abs(N-M)

if abs_NM>1:

    print((0))

    exit()



p=10**9+7

min_=min(N,M)

max_=max(N,M)

ans=1

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

    ans=(ans*i)%p

    ans=(ans*i)%p



if abs_NM==1:

    ans=(ans*max_)%p

else:

    ans=(ans*2)%p



print(ans)
N, M = list(map(int, input().split()))
abs_NM = abs(N - M)
if abs_NM > 1:
    print((0))
    exit()
p = 10**9 + 7
ans = 1
for i in range(1, N + 1):
    ans = (ans * i) % p
for i in range(1, M + 1):
    ans = (ans * i) % p
if abs_NM == 0:
    ans = (ans * 2) % p
print(ans)

N, M = list(map(int, input().split()))
abs_NM = abs(N - M)
if abs_NM > 1:
    print((0))
    exit()
p = 10**9 + 7
min_ = min(N, M)
max_ = max(N, M)
ans = 1
for i in range(1, min_ + 1):
    ans = (ans * i) % p
    ans = (ans * i) % p
if abs_NM == 1:
    ans = (ans * max_) % p
else:
    ans = (ans * 2) % p
print(ans)

+min_ = min(N, M) +max_ = max(N, M) -for i in range(1, N + 1): +for i in range(1, min_ + 1): -for i in range(1, M + 1): -if abs_NM == 0: +if abs_NM == 1: +    ans = (ans * max_) % p +else: