from collections import * from itertools import * from functools import * from heapq import * import sys,math input = sys.stdin.readline N = int(input()) mod = 10**12 tmp = 1 for _ in range(1,min(N+1,1000)): tmp *= _ tmp %= mod print(tmp)