import scala.io.StdIn

object Main extends App {

  val n = StdIn.readLine().toLong
  
  def solve(x: Long): Long = x % (scala.math.pow(10, 9) + 7).toLong
  
  def fact(i: Long, before: Long): Long = {
    if (i == n) solve(before * n)  
    else fact(i + 1, solve(i * before))
  }

  println(fact(1, 1))
  
}