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