import math



N = int(eval(input()))



num = math.factorial(N)



k, r = divmod(num, 10**9 + 7)

print(r)
N = int(eval(input()))



FACTOR = 10 ** 9 + 7



num = 1

for i in range(1, N+1):

    num *= i

    k, r = divmod(num, FACTOR)

    num = r



print(r)
import math

N = int(eval(input()))
num = math.factorial(N)
k, r = divmod(num, 10**9 + 7)
print(r)

N = int(eval(input()))
FACTOR = 10**9 + 7
num = 1
for i in range(1, N + 1):
    num *= i
    k, r = divmod(num, FACTOR)
    num = r
print(r)

-import math - -num = math.factorial(N) -k, r = divmod(num, 10**9 + 7) +FACTOR = 10**9 + 7 +num = 1 +for i in range(1, N + 1): +    num *= i +    k, r = divmod(num, FACTOR) +    num = r