N=int(input()) if N>=60: print("0"*12) exit() ANS=1 for i in range(2,N): ANS*=i ANS%=10**12 ANS=str(ANS) print("0"*(12-len(ANS))+ANS)