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