n = int(input()) mod = 10**12 ans = 1 if n < 50: for i in range(1,n+1): ans *= i ans %= mod print(ans) else: print(0)