open Num
       
let mod109p7 x = mod_num x (num_of_int 1000000007)

let fact x =
  let rec loop n a =
    if n == 1 then a
    else loop (n-1) (mod109p7 (a */ (num_of_int n))) in
  int_of_num @@ loop x (num_of_int 1)

let () = read_int () |> fact |> string_of_int |> print_endline

