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