a = float(input()) ans = 1e20 for n in range(2,100): l,r = 0,100 while r-l>1: m = (l+r)//2 if pow(n,m) >= a: r = m else: l = m if pow(n,r) >= a and ans > n*r: ans = n*r print(ans)