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