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