import qualified Data.ByteString.Char8 as BS
import Control.Monad
import Data.Maybe (fromJust)
import Debug.Trace

modNum :: Int
modNum = 10^9 + 7

solve :: Int -> Int -> Int
solve 0 a = a
solve x a = solve (x - 1) ((x * a) `mod` modNum)

main :: IO ()
main = do
    n <- (fst . fromJust . BS.readInt) <$> BS.getLine
    print $ solve n 1