N = int(input()) if N >= 50: print("0"*12) exit() mod = 10 ** 12 now = 1 f = False for i in range(1,N+1): now *= i if now >= 10 ** 12: f = True now %= mod if f: ans = ("0" * 12 + str(now))[-12:] else: ans = str(now) print(ans)