import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N = int(read()) fact = [1] * 1000 for n in range(1,1000): fact[n] = fact[n-1] * n if N >= 1000: answer = 0 else: answer = fact[N] print(answer % (10**12))