from math import factorial N=int(input()) print(("0"*12,str(factorial(N))[-12:])[N<50])