N = int(input()) ans = 1 mod = 10 ** 12 for i in range(1,N+1): ans = ans * i % mod if ans == 0:break print(ans)