import math

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

n[1] %= (10**9 + 7)

n[0] %= (10**9 + 7)

if n[1] - n[0] >= 2:

    ans = 0

elif n[1] - n[0] == 0:

    ans = math.factorial(n[1]) **2 * 2

else:

    ans = n[1] * math.factorial(n[0])**2

print((ans % (10**9 + 7) ))
import math

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

n[1] %= (10**9 + 7)

n[0] %= (10**9 + 7)

if n[1] - n[0] >= 2:

    ans = 0

elif n[1] - n[0] == 0:

    ans = (math.factorial(n[1])%(10**9 + 7)) **2 * 2

else:

    ans = n[1] * (math.factorial(n[0]) % (10**9 + 7))**2

print((ans % (10**9 + 7) ))
import math

n = sorted(list(map(int, input().split())))
n[1] %= 10**9 + 7
n[0] %= 10**9 + 7
if n[1] - n[0] >= 2:
    ans = 0
elif n[1] - n[0] == 0:
    ans = math.factorial(n[1]) ** 2 * 2
else:
    ans = n[1] * math.factorial(n[0]) ** 2
print((ans % (10**9 + 7)))

import math

n = sorted(list(map(int, input().split())))
n[1] %= 10**9 + 7
n[0] %= 10**9 + 7
if n[1] - n[0] >= 2:
    ans = 0
elif n[1] - n[0] == 0:
    ans = (math.factorial(n[1]) % (10**9 + 7)) ** 2 * 2
else:
    ans = n[1] * (math.factorial(n[0]) % (10**9 + 7)) ** 2
print((ans % (10**9 + 7)))

-    ans = math.factorial(n[1]) ** 2 * 2 +    ans = (math.factorial(n[1]) % (10**9 + 7)) ** 2 * 2 -    ans = n[1] * math.factorial(n[0]) ** 2 +    ans = n[1] * (math.factorial(n[0]) % (10**9 + 7)) ** 2