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