x,y=list(map(int,input().split()))

import math

xx=math.factorial(x)

yy=math.factorial(y)

if x==y:

    print((xx*yy*2%((10**9)+7)))

elif abs(x-y)==1:

    print((xx*yy%((10**9)+7)))

else:

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

if abs(n-m)>1:

    print((0))

    exit()

mod=10**9+7

from math import factorial

x=factorial(n)

y=factorial(m)

if n==m:

    print((((x%mod)*(y%mod)*2)%mod))

else:

    print((((x%mod)*(y%mod))%mod))
x, y = list(map(int, input().split()))
import math

xx = math.factorial(x)
yy = math.factorial(y)
if x == y:
    print((xx * yy * 2 % ((10**9) + 7)))
elif abs(x - y) == 1:
    print((xx * yy % ((10**9) + 7)))
else:
    print((0))

n, m = list(map(int, input().split()))
if abs(n - m) > 1:
    print((0))
    exit()
mod = 10**9 + 7
from math import factorial

x = factorial(n)
y = factorial(m)
if n == m:
    print((((x % mod) * (y % mod) * 2) % mod))
else:
    print((((x % mod) * (y % mod)) % mod))

-x, y = list(map(int, input().split())) -import math +n, m = list(map(int, input().split())) +if abs(n - m) > 1: +    print((0)) +    exit() +mod = 10**9 + 7 +from math import factorial -xx = math.factorial(x) -yy = math.factorial(y) -if x == y: -    print((xx * yy * 2 % ((10**9) + 7))) -elif abs(x - y) == 1: -    print((xx * yy % ((10**9) + 7))) +x = factorial(n) +y = factorial(m) +if n == m: +    print((((x % mod) * (y % mod) * 2) % mod)) -    print((0)) +    print((((x % mod) * (y % mod)) % mod))