integer N,Y
integer m,g,s !万，五千,千

read*,N,Y

do i=0,N
  m=N-i
  do j=0,i
    g=i-j
    s=j
    if(GK(m,g,s)==Y)then
      print"(I0,A,i0,A,i0)",m," ",g," ",s
      STOP
    endif
  end do
end do

print"(I0,A,i0,A,i0)",-1," ",-1," ",-1
contains

pure function GK(m,g,s)
integer,intent(in)::m,g,s
integer GK
GK=m*10000+g*5000+s*1000
end function GK
end