open Printf
open Scanf
open Num

let fact n =
  let d = num_of_int 1000000007 in
  let rec iter a x =
    if x = 1 then a
    else
      iter (mod_num ((num_of_int x) */ a ) d) (x-1)
  in iter (num_of_int 1) n

let () =
  let n, m = scanf "%d %d\n" (fun x y -> (x, y)) in
  begin
    match abs (n - m) with
      0 -> string_of_num (mod_num ((num_of_int 2) */ (fact n) */ (fact m)) (num_of_int 1000000007))
    | 1 -> string_of_num (mod_num ((fact n) */ (fact m)) (num_of_int 1000000007))
    | _ -> "0"
  end |> printf "%s\n"
