import math

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

a = 1000000007

if not (0 <= abs(n-m) <= 1):

    print((0))

    exit()



if n == m:

    num = 2

else:

    num = 1

print((num*math.factorial(n)*math.factorial(m) % a))
n,m = list(map(int,input().split()))

a = 10**9+7

if m > n:

    n,m = m,n

if not (0 <= n-m <= 1):

    print((0))

    exit()

 

if n == m:

    num = 2

    n = 1

else:

    num = 1

t = 1

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

    t *= i

    t %= a

print((num*t*t*n%a))
import math

n, m = list(map(int, input().split()))
a = 1000000007
if not (0 <= abs(n - m) <= 1):
    print((0))
    exit()
if n == m:
    num = 2
else:
    num = 1
print((num * math.factorial(n) * math.factorial(m) % a))

n, m = list(map(int, input().split()))
a = 10**9 + 7
if m > n:
    n, m = m, n
if not (0 <= n - m <= 1):
    print((0))
    exit()
if n == m:
    num = 2
    n = 1
else:
    num = 1
t = 1
for i in range(1, m + 1):
    t *= i
    t %= a
print((num * t * t * n % a))

-import math - -a = 1000000007 -if not (0 <= abs(n - m) <= 1): +a = 10**9 + 7 +if m > n: +    n, m = m, n +if not (0 <= n - m <= 1): +    n = 1 -print((num * math.factorial(n) * math.factorial(m) % a)) +t = 1 +for i in range(1, m + 1): +    t *= i +    t %= a +print((num * t * t * n % a))