INFTY = 10**9 + 7

N = int(eval(input()))

p = 1

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

    p = (p*i)%INFTY

print(p)
p = 10**9+7

N = int(eval(input()))

cnt = 1

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

    cnt = (cnt*i)%p

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

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

-INFTY = 10**9 + 7 +p = 10**9 + 7 -p = 1 -for i in range(2, N + 1): -    p = (p * i) % INFTY -print(p) +cnt = 1 +for i in range(1, N + 1): +    cnt = (cnt * i) % p +print(cnt)