class Factorial(): def __init__(self, mod=10**9 + 7): self.mod = mod self._factorial = [1] self._size = 1 def __call__(self, n): '''n! % mod''' if self._size < n+1: for i in range(self.size, n+1): self._factorial.append(self._factorial[-1]*i % self.mod) self._size = n+1 return self._factorial[n] factorial = Factorial() print(factorial(int(input())))