N = int(input()) mod = int(1e12) if N >= 50: print("0"*12) else: k = 1 for i in range(N): k *= i + 1 k %= mod print(k)