x = 10 ^ 9 + 7

main = print.reconciled.map read.words =<< getLine
reconciled [n, m]
  | n == m = mod (fact n * fact m * 2) x
  | abs n - m == 1 = mod (fact n * fact m) x
  | otherwise = 0
fact 1 = 1
fact n = mod (n * fact (n - 1)) x