N=int(input()) if N>=50: print("0"*12) else: X=1 Y=1 for i in range(1,N+1): X*=i X%=10**12 Y*=i if Y>=10**12: print(str(X)[-12:]) else: print(X)