n = int(input()) ans = 1 while n>1: ans = ans*n n -= 1 if ans > 100000000000: s = str(ans) print(s[-12:]) else: print(ans)