N = int(eval(input()))

p = 1

m = int(1e+9 + 7)

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

    p = p * i

    if p > m:

        p = p % m

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

p = 1

mod = 1000000007

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

    p *= i

    p = p % mod

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

n = int(eval(input()))
p = 1
mod = 1000000007
for i in range(1, n + 1):
    p *= i
    p = p % mod
print(p)

-N = int(eval(input())) +n = int(eval(input())) -m = int(1e9 + 7) -for i in range(1, N + 1): -    p = p * i -    if p > m: -        p = p % m +mod = 1000000007 +for i in range(1, n + 1): +    p *= i +    p = p % mod