A=int(input()) z=float('inf') for n in range(2,60): for m in range(1,60): if n**m>=A: z=min(z,n*m);break print(z)