

{-
     9 * a + 5 * b =  10 * N - Y
         a +     b <= N

-}

isInt :: (RealFrac a) => a -> Bool
isInt x = x == fromInteger (round x)

main = do
    input <- fmap words getLine
    let (n, y) = (read $ head input, (read $ input!!1) / 1000)
    let pairs = [(a, b) | a <- [0..n], b <- [0..n], a + b <= n]
    let satisfiesEquation = filter (\(a ,b) -> 9 * a + 5 * b == 10 * n - y) pairs
    let (t, f) = head $ filter (\(a, b) -> isInt a && isInt b) satisfiesEquation
    let (thousand, fiveThousand) = (round t, round f)
    putStr $ show thousand
    putStr " "
    putStr $ show  fiveThousand
    putStr " "
    putStrLn $ show $ (round $ n - t - f)
