N=int(input()) ANS=1 for i in range(1,N+1): ANS=ANS*i%(10**60) if ANS==0: print("0"*12) break X=str(ANS)[-12:] print(X)