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 if N>=50: print('0'*12) exit() for _ in range(1,N+1): tmp *= _ tmp %= mod print(tmp)