N = int(eval(input()))

MOD = 10 ** 9 + 7



power = 1

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

    power *= i

    power %= MOD

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

MOD = 10**9+7

p = 1

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

  p = (p*i) % MOD

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

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

-N = int(eval(input())) +n = int(eval(input())) -power = 1 -for i in range(1, N + 1): -    power *= i -    power %= MOD -print(power) +p = 1 +for i in range(1, n + 1): +    p = (p * i) % MOD +print(p)