N = int(input()) n = 0 if N<=50: n = 1 MOD = 10**12 for i in range(2,N+1): n = (n*i)%MOD if N<15: print(n) else: print(f"{n:012d}")