open System
open System.Collections.Generic

[<AutoOpen>]
module Cin =
    let read f = stdin.ReadLine() |> f
    let reada f = stdin.ReadLine().Split() |> Array.map f

    let readInts() =
        read string
        |> Seq.toArray
        |> Array.map (fun x -> Convert.ToInt32(x.ToString()))

module Util =
    let strRev (s: string): string =
        s
        |> Seq.rev
        |> Seq.map string
        |> String.concat ""

    let inline roundup (x: ^a) (y: ^a): ^a =
        let one = LanguagePrimitives.GenericOne
        (x + y - one) / y


[<RequireQualifiedAccess>]
module ModIntInner =

    let inline init (x: ^a) (modulo: int64): int64 =
        let x = (int64 x) % modulo
        match x with
        | _ when x < 0L -> x + modulo
        | _ when x >= modulo -> x - modulo
        | _ -> x

    let inline add (lhs: ^a) (rhs: ^b) (modulo: int64) =
        let l = (int64 lhs) % modulo
        let r = (int64 rhs) % modulo
        init (l + r) modulo

    let inline sub (lhs: ^a) (rhs: ^b) (modulo: int64) =
        let l = (int64 lhs) % modulo
        let r = (int64 rhs) % modulo
        init (l - r) modulo

    let inline mul (lhs: ^a) (rhs: ^b) (modulo: int64) =
        let l = (int64 lhs) % modulo
        let r = (int64 rhs) % modulo
        init (l * r) modulo

    let inline inverse (a: ^a) (modulo: int64): int64 =
        let mutable (a, b, u, v) = (int64 a, modulo, 1L, 0L)
        while b > 0L do
            let t = a / b
            a <- a - (t * b)
            let tmp = a
            a <- b
            b <- tmp
            u <- u - (t * v)
            let tmp = u
            u <- v
            v <- tmp
        init u modulo

    let inline div (lhs: ^a) (rhs: ^b) (modulo: int64) =
        let l = (int64 lhs) % modulo
        let r = inverse rhs modulo
        init (l * r) modulo

    let inline pow (a: ^a) (n: ^b) (modulo: int64) =
        let mutable (res, a, n) = (1L, int64 a, int64 n)
        while n > 0L do
            if (n &&& 1L) = 1L then res <- res * a % modulo
            a <- a * a % modulo
            n <- n >>> 1
        res

type ModInt =  {
    modulo : int64
} with
    member __.Add(l: int64, r: int64) =
        let m = __.modulo
        let l = ModIntInner.init l m
        let r = ModIntInner.init r m
        ModIntInner.add l r m

    member __.Sub(l: int64, r: int64) =
        let m = __.modulo
        let l = ModIntInner.init l m
        let r = ModIntInner.init r m
        ModIntInner.sub l r m

    member __.Mul(l: int64, r: int64) =
        let m = __.modulo
        let l = ModIntInner.init l m
        let r = ModIntInner.init r m
        ModIntInner.mul l r m

    member __.Div(l: int64, r: int64) =
        let m = __.modulo
        let l = ModIntInner.init l m
        let r = ModIntInner.init r m
        ModIntInner.div l r m

[<EntryPoint>]
let main _ =
    let n = read int
    let modint = { ModInt.modulo = int64 1e9 + 7L }
    let mutable ans = 1L
    for i in 1..n do
        ans <- modint.Mul(ans, int64 i)
    printfn "%d" ans
    0 // return an integer exit code
