read*,in,iy
  do i=0,in
     do j=0,in-i
        isum=10000*i+5000*j+1000*(in-i-j)
        if (isum==iy) then
           print*,i,j,in-i-j
           stop 
        end if
     end do
  end do
  print*,-1,-1,-1
end program
