N = int(eval(input()))

 

power = 1

 

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

    power = (power*i) % (10**9 + 7)

 

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



MOD = 10**9 +7 



ans = 1

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

    ans = (ans * i) % MOD



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

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

-power = 1 +MOD = 10**9 + 7 +ans = 1 -    power = (power * i) % (10**9 + 7) -print(power) +    ans = (ans * i) % MOD +print(ans)