-- Question C

import Control.Applicative

main = do
  [n,m] <- map read . words <$> getLine
  putStrLn $ show ((check n m)  `mod` (10^9+7))
  
fact a = if a==0 then 1 else (a*fact (a-1))`mod` (10^9+7)
check n m 
  | abs (n-m) >1 = 0
  | n==m+1 = fact n * fact m
  | m==n+1 = fact n * fact m
  | otherwise = (fact n ^2) * 2

