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

INF = 10**9+7



if abs(n-m) > 1:

    print((0))

else:

    nf = 1

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

        nf *= i

        nf %= INF



    mf = 1

    for i in range(1, m+1):

        mf *= i

        mf %= INF



    if n == m:

        print((nf * mf * 2 % INF))

    else:

        print((nf * mf % INF))
n, m = list(map(int, input().split()))

MOD = 10**9+7



if abs(n-m) > 1:

    print((0))

else:

    nf, mf = 1, 1

    for i in range(1, min(n, m)+1):

        nf = (nf*i) % MOD



    if n != m:

        mf = max(n, m) * nf

    else:

        mf = nf



    if n == m:

        print((nf * mf * 2 % MOD))

    else:

        print((nf * mf % MOD))
n, m = list(map(int, input().split()))
INF = 10**9 + 7
if abs(n - m) > 1:
    print((0))
else:
    nf = 1
    for i in range(1, n + 1):
        nf *= i
        nf %= INF
    mf = 1
    for i in range(1, m + 1):
        mf *= i
        mf %= INF
    if n == m:
        print((nf * mf * 2 % INF))
    else:
        print((nf * mf % INF))

n, m = list(map(int, input().split()))
MOD = 10**9 + 7
if abs(n - m) > 1:
    print((0))
else:
    nf, mf = 1, 1
    for i in range(1, min(n, m) + 1):
        nf = (nf * i) % MOD
    if n != m:
        mf = max(n, m) * nf
    else:
        mf = nf
    if n == m:
        print((nf * mf * 2 % MOD))
    else:
        print((nf * mf % MOD))

-INF = 10**9 + 7 +MOD = 10**9 + 7 -    nf = 1 -    for i in range(1, n + 1): -        nf *= i -        nf %= INF -    mf = 1 -    for i in range(1, m + 1): -        mf *= i -        mf %= INF +    nf, mf = 1, 1 +    for i in range(1, min(n, m) + 1): +        nf = (nf * i) % MOD +    if n != m: +        mf = max(n, m) * nf +    else: +        mf = nf -        print((nf * mf * 2 % INF)) +        print((nf * mf * 2 % MOD)) -        print((nf * mf % INF)) +        print((nf * mf % MOD))