(defn otoshidama [n y]
  (for [a (range 0 n) b (range (- n a))
        :let [c (- n a b)]
        :when (= (+ (* 10000 a) (* 5000 b) (* 1000 c)) y)]
    (format "%d %d %d" a b c)))

(println (first (otoshidama (read) (read))))