import Control.Monad.State
import Control.Arrow
import Data.List

getInts = map read . words <$> getLine :: IO [Int]

type PayPair = [Int]
type Price = Int
type Osatsu = Price
type Amount = Int

check :: Price -> Amount -> [Osatsu] -> PayPair
check _ _ [] = [-1]
check p a (o:[]) = if p /= a * o then [-1] else [a]
check p a (o:arr) = do
    if o * a < p then (-1):(map (\_ -> -1) arr)
    else do
        let pays = take (p `div` o + 1) [0..]
        let calcs = map tryPay pays
        let cands = filter (\x -> head x /= -1) calcs
        if length cands < 1 then head calcs else head cands
        where
            tryPay x = do
                let next = check (p - x * o) (a - x) arr
                if head next == -1 then (-1):next else x:next

main = do
    (a:p:_) <- getInts
    putStrLn $ map show >>> intercalate " " $ check p a [10000, 5000, 1000]

