program otoshidama
  implicit none
  integer i,j,man,sen,gosen
  integer*8 n,total

  read(*,*) n,total
  total=total/1000

  do man = 0,n
     do gosen = 0,n-man
        sen = n - man - gosen
        select case(total-sen-5*gosen-10*man)
        case(0)
           write(*,*) man,gosen,sen
           stop
        end select
     end do
  end do

  write(*,*) -1,-1,-1
    
end program otoshidama
