module Main where

import Control.Applicative
import Control.Monad
import Data.List

p = 10 ^ 9 + 7

f :: Int -> Int
f n = iter 1 n
  where
    iter s 1 = s
    iter s k = iter ((s * k) `mod` p) (k - 1)

main :: IO ()
main = do
    [n, m] <- fmap read . words <$> getLine :: IO [Int]

    case abs (n - m) of
        0 -> print $ (f n * f m * 2) `mod` p
        1 -> print $ (f n * f m) `mod` p
        _ -> print 0