N = int(input()) x = 1 for i in range(2,N+1): x *= i x = str(x) if(len(x) <= 12): print(x) else: print(x[len(x)-12:])