# coding: utf-8

ans = 1

for i in range(1, int(eval(input()))+1):

    ans *= i

    ans %= (10**9 + 7)

print(ans)
# coding: utf-8

ans = 1

n_mod = 10**9 + 7

for i in range(1, int(eval(input()))+1):

    ans = (ans * i) % n_mod

print(ans)

# coding: utf-8
ans = 1
for i in range(1, int(eval(input())) + 1):
    ans *= i
    ans %= 10**9 + 7
print(ans)

# coding: utf-8
ans = 1
n_mod = 10**9 + 7
for i in range(1, int(eval(input())) + 1):
    ans = (ans * i) % n_mod
print(ans)

+n_mod = 10**9 + 7 -    ans *= i -    ans %= 10**9 + 7 +    ans = (ans * i) % n_mod