N=int(eval(input()))

ans=1

DIV=10**9+7

while N>1:

  ans=(ans*(N%DIV))%DIV

  N-=1

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

p=1

DIV=10**9+7

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

  p = (p%DIV * i%DIV) % DIV

  

print(p)
N = int(eval(input()))
ans = 1
DIV = 10**9 + 7
while N > 1:
    ans = (ans * (N % DIV)) % DIV
    N -= 1
print(ans)

N = int(eval(input()))
p = 1
DIV = 10**9 + 7
for i in range(1, N + 1):
    p = (p % DIV * i % DIV) % DIV
print(p)

-ans = 1 +p = 1 -while N > 1: -    ans = (ans * (N % DIV)) % DIV -    N -= 1 -print(ans) +for i in range(1, N + 1): +    p = (p % DIV * i % DIV) % DIV +print(p)