let ( *@ ) a b = (a * b) mod 1000000007
let fact = let rec f v n = if n <= 0 then v else f (n *@ v) (n-1) in f 1
let n, m = Scanf.scanf "%d %d" (fun x y -> x, y)
let () =
  let mul = 2 - abs (n - m) |> max 0 in
  fact n *@ fact m *@ mul |> Printf.printf "%d\n"