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

solve :: Integer -> Integer -> Integer
solve n m | abs (n - m) >= 2 = 0
          | abs (n - m) == 1 = let x = max n m
                                in x * (fact (x-1))^2 `mod` lim
          | otherwise = (2 * (fact n)^2) `mod` lim

fact :: Integer -> Integer
fact 1 = 1
fact i = i * fact (i-1)

lim = 10^9 + 7 :: Integer
