n = input() mod = 1000000000000 ans = 1 for i in range(1, n + 1): ans *= i if ans > 12: tmp = ans % mod print "{0:012d}".format(tmp) else: print ans