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