N, M = [int(_) for _ in input().split()]

mod = 10**9+7



if N < M:

    N, M = M, N



if N == M:

	answer = 2

	for i in range(2, N+1):

		answer = answer * i * i

		answer = answer % mod

	print (answer)



elif N == M+1:

	answer = 1

	for i in range(2, N):

		answer = answer * i * i

		answer = answer % mod

	answer = answer * N % mod

	print(answer)



else:

	print((0))
N, M = [int(_) for _ in input().split()]

mod = 10**9+7



if N < M:

	N, M = M, N



if N == M:

	answer = 1

	for i in range(2, N+1):

		answer = answer * i

		answer = answer % mod

	answer = answer**2 * 2 % mod

	print (answer)



elif N == M+1:

	answer = 1

	for i in range(2, M+1):

		answer = answer * i 

		answer = answer % mod

	answer = answer**2 * N % mod

	print(answer)



else:

	print((0))
N, M = [int(_) for _ in input().split()]
mod = 10**9 + 7
if N < M:
    N, M = M, N
if N == M:
    answer = 2
    for i in range(2, N + 1):
        answer = answer * i * i
        answer = answer % mod
    print(answer)
elif N == M + 1:
    answer = 1
    for i in range(2, N):
        answer = answer * i * i
        answer = answer % mod
    answer = answer * N % mod
    print(answer)
else:
    print((0))

N, M = [int(_) for _ in input().split()]
mod = 10**9 + 7
if N < M:
    N, M = M, N
if N == M:
    answer = 1
    for i in range(2, N + 1):
        answer = answer * i
        answer = answer % mod
    answer = answer**2 * 2 % mod
    print(answer)
elif N == M + 1:
    answer = 1
    for i in range(2, M + 1):
        answer = answer * i
        answer = answer % mod
    answer = answer**2 * N % mod
    print(answer)
else:
    print((0))

-    answer = 2 +    answer = 1 -        answer = answer * i * i +        answer = answer * i +    answer = answer**2 * 2 % mod -    for i in range(2, N): -        answer = answer * i * i +    for i in range(2, M + 1): +        answer = answer * i -    answer = answer * N % mod +    answer = answer**2 * N % mod