n = int(input()) ans = [] now = 1 check = "0"*12 for i in range(1000): now *= max(1,i) ans.append(now) if len(str(now)) > 12 and str(now)[::-1][:12][::-1] == check: break #print(len(ans)) if n >= 50: print(check) else: print(str(ans[n])[::-1][:12][::-1])