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



mod = 10 ** 9 + 7



def mod_fact(n, mod = 10 ** 9 + 7):

    result = 1

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

        result = (result * i) % mod

    return result



if N == M:

    print(((2 * mod_fact(N) * mod_fact(M)) % mod))

elif abs(N - M) == 1:

    print(((mod_fact(N) * mod_fact(M)) % mod))

else:

    print((0))

def mod_fact(n, mod):

    ans = 1

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

        ans = ans * i % mod

    return ans



mod = 10 ** 9 + 7



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



if N == M:

    print((2 * mod_fact(N, mod) ** 2 % mod))

elif abs(N - M) == 1:

    print((mod_fact(min(M, N), mod) ** 2 * max(M, N) % mod))

else:

    print((0))

N, M = [int(i) for i in input().split()]
mod = 10**9 + 7


def mod_fact(n, mod=10**9 + 7):
    result = 1
    for i in range(2, n + 1):
        result = (result * i) % mod
    return result


if N == M:
    print(((2 * mod_fact(N) * mod_fact(M)) % mod))
elif abs(N - M) == 1:
    print(((mod_fact(N) * mod_fact(M)) % mod))
else:
    print((0))

def mod_fact(n, mod):
    ans = 1
    for i in range(2, n + 1):
        ans = ans * i % mod
    return ans


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

-N, M = [int(i) for i in input().split()] -mod = 10**9 + 7 +def mod_fact(n, mod): +    ans = 1 +    for i in range(2, n + 1): +        ans = ans * i % mod +    return ans -def mod_fact(n, mod=10**9 + 7): -    result = 1 -    for i in range(2, n + 1): -        result = (result * i) % mod -    return result - - +mod = 10**9 + 7 +N, M = list(map(int, input().split())) -    print(((2 * mod_fact(N) * mod_fact(M)) % mod)) +    print((2 * mod_fact(N, mod) ** 2 % mod)) -    print(((mod_fact(N) * mod_fact(M)) % mod)) +    print((mod_fact(min(M, N), mod) ** 2 * max(M, N) % mod))