import Data.List
main = do
       e <- getLine
       let (x:y:[])=map read (words e)::[Int]
           t = [(e1,e2,e3)| e1<-[0..x],e2<-[0..(x-e1)],e3<-[(x-e1-e2)..(x-e1-e2)],y==e1*10000+e2*5000+e3*1000]
       putStrLn $ if null t then "-1 -1 -1"
                            else let (a1,b1,c1)=head t
                                 in (show a1)++" "++(show b1)++" "++(show c1)