N = int(input()) if N >= 50: print('0' * 12) else: x = 1 for i in range(1, N + 1): x *= i x = str(x) print(x[max(-len(x), -12):])