n=int(eval(input()))

ans=1

mod=10**9+7

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

  ans=(ans*i)%mod

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

ans=1

mod=10**9+7

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

  ans=((ans%mod)*i)

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

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

-    ans = (ans * i) % mod -print(ans) +    ans = (ans % mod) * i +print((ans % mod))