import math

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

mod = (10**9)+7

N = math.factorial(n)

M = math.factorial(m)

mul = 0 if abs(n-m)>1 else 2 if n==m else 1 

print((N*M*mul%mod))
import math

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

mod = (10**9)+7

mul = 0 if abs(n-m)>1 else 2 if n==m else 1

a = min(n,m)

A = math.factorial(a)

B = A

if mul==1:

  B*=max(n,m)

print((A*B*mul%mod))
import math

n, m = list(map(int, input().split()))
mod = (10**9) + 7
N = math.factorial(n)
M = math.factorial(m)
mul = 0 if abs(n - m) > 1 else 2 if n == m else 1
print((N * M * mul % mod))

import math

n, m = list(map(int, input().split()))
mod = (10**9) + 7
mul = 0 if abs(n - m) > 1 else 2 if n == m else 1
a = min(n, m)
A = math.factorial(a)
B = A
if mul == 1:
    B *= max(n, m)
print((A * B * mul % mod))

-N = math.factorial(n) -M = math.factorial(m) -print((N * M * mul % mod)) +a = min(n, m) +A = math.factorial(a) +B = A +if mul == 1: +    B *= max(n, m) +print((A * B * mul % mod))