def format(n): string = str(n) if len(string) != 12 and string[0] == "0": return ("0"*(12-len(string)) + string) else: return string def main(): N = int(input()) answer = 1 for i in range(1, N+1): answer = (answer * i) % 10**12 if answer == 0: break print(format(answer)) main()