main = interact $ show . sol . map read . words

sol [n,m] = if abs (n-m) > 1 then 0 
  else f n @*@ f m @*@ if n==m then 2 else 1

f x = foldl1 (@*@) [1..x]

infixl 7 @*@
(@*@) a b = a*b `mod` (10^9+7 :: Int)