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