let rec solve n =
    let rec _solve n a =
        match n with
        1 -> a
        | n -> _solve (n - 1) ((a * n) mod 1000000007) in
    _solve n 1;;

let () =
    let n = read_int () in
    print_int (solve n);
    print_newline ();;

