program main
  implicit none
  integer(8) :: x
  integer(8) :: str, ai, a
  real(8) :: rtmp, ar

  read *, x

  str = real(x) ** (1.0/5.0)
  rtmp = real(x) ** (1.0/5.0)

  do 
    if ( str == rtmp ) then
      print *, str, '0'
      exit
    else
      a = x - str**5
      ai = real(a) ** (1.0/5.0)
      ar = real(a) ** (1.0/5.0)
      if ( ai == ar ) then
        print *, str, (-1)*ai
        exit
      else
        str = str + 1
      end if
    end if
  end do

end program main
