n = int(input()) res = 1 for i in range(1, n + 1): res *= i if len(str(res)) > 6: res = int(str(res)[-12:]) print(str(res)[-12:])