a = int(input()) ans = 200 for n in range(2,130): com = 1 for m in range(1,100): com *= n if(com >= a): break ans = min(n*m,ans) print(ans)