import           Data.Int

modc = 1000000007 :: Int64

fact :: Int -> Int64
fact x | x == 0    = 1 :: Int64
       | otherwise = fromIntegral x * fact (x - 1) `mod` modc

sqr :: Int64 -> Int64
sqr x = x * x `mod` modc

solve :: Int -> Int -> Int64
solve n m | n < m      = solve m n
          | n == m     = fromIntegral 2 * sqr (fact n) `mod` modc
          | n == m + 1 = fact n * fact m
          | otherwise  = 0

main = do
  input <- getLine
  let n : m : [] = map (read :: String -> Int) $ words input
  putStrLn . show $ solve n m
  return ()
