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