n = int(input()) if n >= 673: print(0) else: result = 1 for i in range(1, n + 1): result = (result * i) % 2019 print(result)