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