import math

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

MOD = 1000000007

count_n = 0

count_m = 0

count = 0

if abs(n-m) == 1:

  count_n = math.factorial(n) % MOD

  count_m = math.factorial(m) % MOD

  count = count_m * count_n % MOD

elif abs(n-m) == 0:

  count_n = math.factorial(n) % MOD

  count_m = math.factorial(m) % MOD

  count = 2 * count_m * count_n % MOD

else:

  count = 0



print((count % MOD))
import math

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

mod = 10**9+7



if abs(N-M) > 1:

  print((0))

  exit()



if N < M:

  N, M = M, N



if N == M:

  ans = math.factorial(N)

  ans %= mod

  ans *= math.factorial(M)

  ans %= mod

  ans *= 2

  ans %= mod

else:

  ans = math.factorial(M)

  ans %= mod

  ans *= math.factorial(N)

  ans %= mod

  



print(ans)
import math

n, m = list(map(int, input().split()))
MOD = 1000000007
count_n = 0
count_m = 0
count = 0
if abs(n - m) == 1:
    count_n = math.factorial(n) % MOD
    count_m = math.factorial(m) % MOD
    count = count_m * count_n % MOD
elif abs(n - m) == 0:
    count_n = math.factorial(n) % MOD
    count_m = math.factorial(m) % MOD
    count = 2 * count_m * count_n % MOD
else:
    count = 0
print((count % MOD))

import math

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

-n, m = list(map(int, input().split())) -MOD = 1000000007 -count_n = 0 -count_m = 0 -count = 0 -if abs(n - m) == 1: -    count_n = math.factorial(n) % MOD -    count_m = math.factorial(m) % MOD -    count = count_m * count_n % MOD -elif abs(n - m) == 0: -    count_n = math.factorial(n) % MOD -    count_m = math.factorial(m) % MOD -    count = 2 * count_m * count_n % MOD +N, M = list(map(int, input().split())) +mod = 10**9 + 7 +if abs(N - M) > 1: +    print((0)) +    exit() +if N < M: +    N, M = M, N +if N == M: +    ans = math.factorial(N) +    ans %= mod +    ans *= math.factorial(M) +    ans %= mod +    ans *= 2 +    ans %= mod -    count = 0 -print((count % MOD)) +    ans = math.factorial(M) +    ans %= mod +    ans *= math.factorial(N) +    ans %= mod +print(ans)