N = int(input()) ans = 1 MAX = 10 ** 12 for i in range(1, N + 1): ans *= i ans %= MAX if not ans: print('0' * 12) exit() print(ans)