program sample
    implicit none
  
    integer(8) :: i,j,m,n,k,c,d,x
    real(8)::a,b
    
  
    read(*,*) x
    m=1
    do i=33,1,-1
        if (i**2<=x)then
            m=i**2
            exit
        end if
    end do
    n=1
    do i=10,1,-1
        n=i**3
        if (n<=x)then
            
            exit
        end if
    end do
    if (n>m)then
        m=n
    end if

    do i=3,1,-1
        if (i**5<=x)then
            n=i**5
            if (n>m)then
                m=n
            end if
            exit
        end if
    end do
    
    if (2**7<=x)then
        n=2**7
        if (n>m)then
            m=n
        end if
    end if
    
    write(*,*) m
  
    stop
end program sample
  

