import math

n = int(eval(input()))

print((math.factorial(n) % (10**9 + 7)))
import math

m = math.factorial(int(eval(input())))

print((m%(10**9+7)))
import math

n = int(eval(input()))
print((math.factorial(n) % (10**9 + 7)))

import math

m = math.factorial(int(eval(input())))
print((m % (10**9 + 7)))

-n = int(eval(input())) -print((math.factorial(n) % (10**9 + 7))) +m = math.factorial(int(eval(input()))) +print((m % (10**9 + 7)))