import           Control.Monad
import           Control.Applicative
import           Data.IORef
import           Data.List.Split
import           Data.Maybe
import           Data.List

main :: IO ()
main = do
  n <- readLn
  print $ prod 1 [1..n]

prod n [x] = by x n
prod n (x:xs) = prod (by x n) xs

by x n = x * n `mod` (10 ^ 9 + 7)