N = int(input()) if N >= 50: print("0"*12) exit() mod = 10 ** 12 now = 1 for i in range(1,N+1): now *= i now %= mod print(now)