n = int(eval(input()))

res = 1

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

  res = res * num

  res = res % (pow(10,9) + 7)

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

res = 1

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

    res = res * num

    res = res % (10**9 + 7)

print(res)

n = int(eval(input()))
res = 1
for num in range(1, n + 1):
    res = res * num
    res = res % (pow(10, 9) + 7)
print(res)

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

-    res = res % (pow(10, 9) + 7) +    res = res % (10**9 + 7)