let divi = 1000000000 + 7

let solve n =
  let rec aux c ret = if c = n then
                        (ret * n) mod divi else
                        aux (c+1) ((ret * c) mod divi)
  in
  aux 1 1

let () =
  let rec read () =
    try let ans = (Scanf.scanf "%d\n" solve) in
        Printf.printf "%d\n" ans
    with End_of_file -> ()
  in
  read ()
;;
