mm = 1000000007

fact :: Integer -> Integer -> Integer
fact n x
  | n == 0 = x
  | otherwise = fact (n - 1) $ (x * n) `mod` mm

solve :: [Integer] -> Integer
solve (n:m:_)
  | diff == 0 = (2 * c) `mod` mm
  | otherwise = c
  where
    diff = abs $ n - m
    c = if diff > 1 then 0 else (fact n 1 * fact m 1) `mod` mm

main = getContents >>= print . solve . map read . words. last . lines
