N = int(eval(input()))

p = 1

for i in range(N):

    p *= (i + 1)

    p %= (1e9 + 7)

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

p = 1

for i in range(N):

    p = p * (i + 1) % (1e9 + 7)

print((int(p)))
N = int(eval(input()))
p = 1
for i in range(N):
    p *= i + 1
    p %= 1e9 + 7
print((int(p)))

N = int(eval(input()))
p = 1
for i in range(N):
    p = p * (i + 1) % (1e9 + 7)
print((int(p)))

-    p *= i + 1 -    p %= 1e9 + 7 +    p = p * (i + 1) % (1e9 + 7)