X=10**9+7



def A(c,d):

    return c*d%X



a=int(eval(input()))

x=1

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

    x = A(x,i)



print(x)

X=10**9+7





a=int(eval(input()))

x=1

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

    x = x*i%X

print(x)

X = 10**9 + 7


def A(c, d):
    return c * d % X


a = int(eval(input()))
x = 1
for i in range(1, a + 1):
    x = A(x, i)
print(x)

X = 10**9 + 7
a = int(eval(input()))
x = 1
for i in range(1, a + 1):
    x = x * i % X
print(x)

- - -def A(c, d): -    return c * d % X - - -    x = A(x, i) +    x = x * i % X