n = int(input()) x = 1 for i in range(1, n+1): x *= i if n <= 14: print(x) else: l = [] x = list(str(x)) for i in range(1, 13): l.append(x[-i]) print(''.join(l[::-1]))