let get_2_ints () = Scanf.scanf "%d %d" (fun u v -> u,v)

module Rep = struct
	let __range ?(stride=1) u v =
    let rec f0 i a = if i>v then a else f0 (i+stride) (i::a)
    in f0 u []
  let __ls_product l r =
    List.map (fun u -> List.map (fun v -> u,v) r) l
    |> List.concat
	let init f = f ()
  let rep ?(stride=1) f t = __range ~stride f t
	let (=+>) v p = (v,p)
	let (=>) (v,p) q = (v,__ls_product p q)
	let (=>>) (v,p) f = List.fold_left f v p
end

let () =
  let (n,y) = get_2_ints ()
  in let open Rep
  in init (fun () -> (-1,-1,-1))
  =+> rep 0 n => rep 0 n =>>
  (fun op (u,v) ->
    let w = n-u-v in
    if w>=0 && u*10000+v*5000+w*1000=y then (u,v,w) else op)
  |> (fun (u,v,w) -> Printf.printf "%d %d %d\n" u v w)

