from math import factorial as f

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

print((max(0,2-abs(N-M))*f(N)*f(M)%(10**9+7)))
from math import *

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



if abs(N-M)==0:

  ans = 2*factorial(N)*factorial(M)

elif abs(N-M)==1:

  ans = factorial(N)*factorial(M)

else:

  ans = 0



print((ans%(10**9+7)))
from math import factorial as f

N, M = list(map(int, input().split()))
print((max(0, 2 - abs(N - M)) * f(N) * f(M) % (10**9 + 7)))

from math import *

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

-from math import factorial as f +from math import * -print((max(0, 2 - abs(N - M)) * f(N) * f(M) % (10**9 + 7))) +if abs(N - M) == 0: +    ans = 2 * factorial(N) * factorial(M) +elif abs(N - M) == 1: +    ans = factorial(N) * factorial(M) +else: +    ans = 0 +print((ans % (10**9 + 7)))