import sys

R = lambda: list(map(int, input().split()))

def lcm(a,b):
    m = a*b
    while a != 0 and b != 0:
        if a > b:
            a %= b
        else:
            b %= a
    return m // (a+b)

n, p, w, d = R()

if (w*n)<p:
    print(-1)
    sys.exit()

if p==0:
    print(0, 0, n)
    sys.exit()

nod = lcm(w, d)
s_w = p//w
s_d = (p-s_w*w)//d
while ((p-s_w*w)%d!=0):
    s_w-=1
    s_d=(p-s_w*w)//d
    if(s_d > nod):
        print(-1)
        sys.exit()
if (s_w>=0)and(s_d>=0):
    print(s_w, s_d, n-(s_w+s_d))
else:
    print(-1)

import math
n,p,w,d=map(int,input().split())
x=-1
y=-1
for i in range(w):
	if (p-i*d)%w==0:
		y=i
		x=(p-d*y)//w
		break
if x<0 or y<0 or x+y>n:
	print(-1)
else:
	print(x,y,n-x-y)

import sys, bisect, heapq, math
sys.setrecursionlimit(10**9+7)
def fi(): return int(sys.stdin.readline())
def fi2(): return map(int, sys.stdin.readline().split())
def fi3(): return sys.stdin.readline().rstrip()
def fo(*args):
    for s in args: sys.stdout.write(str(s)+' ')
    sys.stdout.write('\n')
##    sys.stdout.flush()
def puts(*args):
    for s in args: sys.stdout.write(str(s))
OUT = []
def bfo(*args):
    for s in args: OUT.append(str(s)+' ')
    OUT.append(' ')
def bputs(*args):
    for s in args: OUT.append(str(s))
def flush():
    sto = ''.join(OUT); fo(sto)
##
alpha = 'abcdefghijklmnopqrstuvwxyz'; mod = 10**9+7; inf = int(2e18+5) ; nax = 101010
##

def gcdExtended(a, b):
    if a == 0 :
        x = 0
        y = 1
        return (x, y)

    x1, y1 = gcdExtended(b%a, a)

    x = y1 - (b//a) * x1
    y = x1

    return (x, y)

n, p, w, d = fi2()

g = math.gcd(w, d)
x, y = gcdExtended(w, d)

ww = w//g
dd = d//g

if p%g != 0:
    print(-1)
    exit()

x = x*p//g
y = y*p//g

assert(w*x + y*d == p)

if y < 0:
    k = abs(y)//ww + 5
    y += ww*k
    x -= dd*k

k = y//ww
y -= ww*k
x += dd*k

assert(w*x + y*d == p)

z = n - x - y

if x >= 0 and y >= 0 and z >= 0:
    print(x, y, z)
else:
    print(-1)

from math import ceil

n,p,w,d = map(int, input().split())
e = x = n
s = 0
y = None
for i in range(64):
    a = x * w
    y = ceil((p - a) / d)
    if y < 0:
        e = x
        x = (s + x) // 2
        continue
    b = y * d
    ss = a + b
    if ss == p and x+y <= n:
        break
    if (a < p) or x + y > n:
        s = x
        x = (e + x) // 2
    else:
        e = x
        x = (s + x) // 2
else:
    dir_ = 1 if p - ss > 0 else -1
    for i in range(100000):
        x += dir_
        a = x * w
        y = (p - a) // d
        b = y * d
        ss = a + b
        if ss == p and x+y <= n:
            break
    else:
        print(-1)
        exit()
if x < 0 or y < 0:
    print(-1)
else:
    print(x, y, n - x - y)

n = p = w = d = 0
x = y = 0

def GCD(a, b):
    while (b != 0):
        c = a % b
        a = b
        b = c
    return a

def ExGCD(a, b):
    global x
    global y
    if (b == 0):
        x = 1
        y = 0
        return
    ExGCD(b, a % b)
    temp = x
    x = y
    y = temp - a / b * y

def main():
    global n, p, w, d, x, y
    s = raw_input()
    n, p, w, d = map(int, s.split())

    gcd = GCD(w, d)
    if (p % gcd != 0):
        print -1
        return 0;
    ExGCD(w, d)
    x = x * (p / gcd)
    y = y * (p / gcd)
    dx = d / gcd
    dy = w / gcd
    k = 0
    k = y / dy # + (-1 if y < 0 and y % dy != 0 else 0)
    x = x + k * dx
    y = y - k * dy
    # print x, y, dx, dy
    if n < x + y or x < 0 or y < 0:
        print -1
    else:
        print x, y,  n - x - y

if __name__ == "__main__":
    main()

import math
n,p,w,d=map(int,input().split())
def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)
j=gcd(w,d)
if n<(math.ceil(p/w)) or p<w and p<d and p>0:
    print('-1')
elif p%j!=0:
    print('-1')
elif p==n and w>p and d>p:
    print('-1')
elif p==0:
    print(0,0,n)
else:
    i=0
    while True:
        if (p-i)%w==0:
            x=(p-i)//w
            y=i//d
            break
        i+=d
    print(x,y,n-x-y)

x=1
y=0
def gcd(a,b):
	if b==0:return a
	else:return gcd(b,a%b);
def exgcd(a,b):
	if b==0:
		return a
	else:
		d=exgcd(b,a%b)
		global x,y
		t=x
		x=y
		y=t-(a//b)*y
		return d
n,p,w,d=map(int,input().split())
g=gcd(w,d)
if p%g!=0:
	print(-1)
else:
	p=p//g
	w=w//g
	d=d//g
	exgcd(w,d)
	x=x*p
	y=y*p
	x=(x%d+d)%d
	y=(p-w*x)//d
	if y!=0:
		y=(y%w+w)%w
		x=(p-y*d)//w
	if y<0 or x<0 or x+y>n:
		print(-1)
	else:
		print(x,y,n-x-y)

# maa chudaaye duniya
n, p ,w, d = map(int, input().split())
wins = -1
draws = -1
for difference in range(w):
	draws = difference
	if (p-d*draws)%w == 0:
		wins = (p-d*draws) // w
		break
if wins < 0 or draws < 0 or wins + draws > n:
	print(-1)
else:
	print(wins, draws, n-wins-draws)

n,p,w,d=map(int,input().split())

#n the number of games
#p the number of points
#w points awarded for winning
#d points awarded for a draw

#impossible if n*w < p
#for p = 10,w = 3,d = 2?
def canDraw(p,w,d):
    dcounter = 0
    if w % d == 0 and p%d != 0:
        dcounter =0

    else:
        while p %w !=0:
            p -= d
            dcounter +=1

    return dcounter

if n*w >= p:
    dcounter = int(canDraw(p,w,d))
    wcounter= int((p - dcounter*d)/w)
    lcounter = int(n - dcounter -wcounter)

    if wcounter < 0 or dcounter <0 or lcounter <0 or wcounter*w + dcounter*d != p:
        print(-1)
    else:
        print(wcounter,dcounter,lcounter)

else:
    print(-1)

n, p, w, d = [int(i) for i in input().split(' ')]

wins = p // w
runs = d + 5
while runs >= 0 and wins >= 0:
    points_to_cover = p - w * wins
    if points_to_cover % d == 0:
        draws = points_to_cover // d
        if wins + draws > n:
            print(-1)
            exit(0)
        print(f'{wins} {draws} {n - wins - draws}')
        exit(0)
    wins -= 1
    runs -= 1
print(-1)

def main():
	(n, p, w, d) = (int(x) for x in input().split())
	result = solver(n, p, w, d)
	if result == -1:
		print(-1)
	else:
		print(*result)

def solver(n, p, w, d):
	maxScore = w * n
	if maxScore < p:
		return -1
	if p % gcd(w, d) != 0:
		return -1
	if p < d and p > 0:
		return -1
	maxWins = p // w
	for i in range(min(maxWins + 1, d)):
		if (p - (maxWins - i) * w) % d == 0:
			wins = maxWins - i
			draws = (p - (maxWins - i) * w) // d
			losses = n - wins - draws
			return (wins, draws, losses)
	return -1

def gcd(x, y):
	(x, y) = (max(x, y), min(x, y))
	while y != 0:
		(x, y) = (y, x % y)
	return x

#print(*solver(30, 60, 3, 1))
#print(solver(10, 51, 5, 4))
#print(solver(20, 0, 15, 5))
#print(*(1, 2, 3, 4))
#print(solver(10, 2, 5, 3))

main()

import math
a,b,c,d=map(int,input().split())
x=-1
y=-1

for i in range(c):
	if (b-i*d)%c==0:
		y=i
		x=(b-d*y)//c
		break
if x<0 or y<0 or x+y>a:
	print(-1)
else:
	print(x,y,a-x-y)

data = input()
data = data.split()
n = int(data[0])
p = int(data[1])
w = int(data[2])
d = int(data[3])

p_int_d = int(p/d)
p_rem_d = p%d
w_int_d = int(w/d)
w_rem_d = w%d

answer = False

if( (p/w) <= n):
    if( (p - n*d) <= 0 ) :
        low_lim = 0
    else :
        low_lim = int( (p - (n-1)*d)/w )
    top_lim = int(p/w)

    remain = False
    i = 0
    k = top_lim
    while (i < w):
        if (((p - w * k) % d) == 0):
            remain = True
            top_lim = k
            break
        i = i + 1
        k = k - 1

    g = 1
    while(i <= w) :
        if( ((i*w)%d) == 0 ):
            g = i
            break
        i = i + 1

    if(remain == True):
        i = top_lim
        while (i >= low_lim) :
            if( (i + int((p-i*w)/d)) <= n ) :
                if( ((p-w*i)%d) == 0 ):
                    answer = True
                    x = i
                    y =int((p-i*w)/d)
                    z = n - x - y
                    break
            else :
                break
            i = i - g

        if(answer == True) :
            print(x, end=' ')
            print(y, end=' ')
            print(z)
        else :
            print(-1)
    else :
        print(-1)
else :
    print(-1)

n,p,w,d = (int(i) for i in input().split())

def gcd(a,b):
    x, xx, y, yy = 1, 0, 0, 1
    while b:
        q = a // b
        a, b = b, a % b
        x, xx = xx, x - xx*q
        y, yy = yy, y - yy*q
    return (x, y, a)

def find_any_solution(a,b,c):
    g = gcd(abs(a),abs(b))
    x0,y0=g[0],g[1]
    if c%g[2] != 0:
        return (0,0,0)
    x0 *= c//g[2]
    y0 *= c//g[2]
    if a<0: x0*=-1
    if b<0: y0*=-1
    return (x0,y0,g[2])

x,y,g = find_any_solution(w,d,p)
if x==y==g==0:
    print(-1)
else:
    lx = x + -(x*g//d)*d//g
    k = -(-(n-x-y)*g//(d-w))
    x+=k*d//g
    y-=k*w//g
    if p == 0:
        print(0,0,n)
    else:
        if x>=0 and y>=0:
            print(x,y, n-x-y)
        else:
            x = lx
            y = (p-w*x)//d
            k = (y-n)*g//w
            if x+y<=n and 0<=x<=n and 0<=y<=n:
                print(x,y,n-x-y)
            else:
                x+=k*d//g
                y-=k*w//g
                k=1
                while x+y>n and x<n and y>=0:
                    x+=k*d//g
                    y-=k*w//g
                    k+=1
                if x+y<=n and 0<=x<=n and 0<=y<=n:
                    print(x,y,n-x-y)
                else:
                    print(-1)

#!/usr/bin/env python3
import sys

n, p, w, d = map(int, next(sys.stdin).split(" "))

def solution():
    a = min(p // d, p // w)
    b = max(p // d + 1, p // w + 1)

    z = max(n - b, 0)
    if n - a < 0:
        print(-1)
        return

    divider = w - d

    if (d % divider == 0 or w % divider == 0) and p % divider != 0:
        print(-1)
        return

    while z <= n - a:
        z2 = n - z

        xdiv = (p - d * z2) // divider
        ydiv = (w * z2 - p) // divider

        xmod = (p - d * z2) % divider
        ymod = (w * z2 - p) % divider

        if xmod == 0 and ymod == 0 and xdiv >= 0 and ydiv >= 0:
            print(xdiv, ydiv, z)
            return
        z += 1

    print(-1)

solution()

n, p, w, d = map(int, input().split())
for y in range(w):
    if (p - y * d) % w == 0 and (p - y * d) // w >= 0 and n >= (p - y * d) // w + y:
        print((p - y * d) // w, y, n - (p - y * d) // w - y)
        break
else:
    print(-1)

# -*- coding: utf-8 -*-

import sys
import time

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

n, p, w, d = MAP()

mxx = p // w
y = -1
start = time.time()
for x in range(mxx, -1, -1):
    if (p-w*x) % d == 0:
        y = (p-w*x) // d
        break
    elapsed_time = time.time() - start
    if elapsed_time > 0.7:
        print(-1)
        exit()

if y == -1:
    print(-1)
    exit()
z = n - x - y
if z < 0:
    print(-1)
    exit()

print(x, y, z)

def exgcd(a, b):
    if a == 0:
        return (b, 0, 1)
    else:
        g, x, y = exgcd(b % a, a)
        return (g, y - (b // a) * x, x)

if __name__ == "__main__":
    n, p, w, d = map(int, input().split())
    r, x, y = exgcd(w, d)
    if p % r:
        print(-1)
    else:
        x = p // r * x
        y = p // r * y
        d = d // r
        w = w // r
        y0 = ((y % w) + w) % w
        x0 = (p // r - y0 * d) // w
        if x0 >= 0 and y0 >= 0 and x0 + y0 <= n:
            print("%d %d %d" % (x0, y0, n - x0 - y0))
        else:
            print(-1)

n,p,w,d=[int(x) for x in input().split()]
for i in range(0,1000000):
    num=p-(d*i)
    if num<0:
        continue
    if num%w:
        continue
    cnt=i+(num//w)
    if cnt>n:
        continue
    print(num//w,i,n-cnt)
    exit()
print(-1)

def exgcd(a, b):
    if b == 0:
        return a, 1, 0
    d, x, y = exgcd(b, a % b)
    t = x
    x = y
    y = t - (a // b) * y
    return d, x, y

n, p, w, d = map(int, input().split())
g, x, y = exgcd(w, d)
if p % g != 0:
    print(-1)
else:
    x *= p // g
    y *= p // g
    w //= g
    d //= g
    if x < 0:
        t = (-x + d - 1) // d
        x += t * d
        y -= t * w
    if y < 0:
        t = (-y + w - 1) // w
        x -= t * d
        y += t * w
    if x < 0 or y < 0:
        print(-1)
    else:
        t = y // w
        x += t * d
        y -= t * w
        if x + y <= n:
            print(x, y, n - x - y)
        else:
            print(-1)

import sys
def exgcd(a,b,l):
    if b==0:
        l[0]=1
        l[1]=0
        return a
    d=exgcd(b,a%b,l)
    t=l[0]-a//b*l[1]
    l[0]=l[1]
    l[1]=t
    return d
def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)
n,p,w,d=map(int,input().split(" "))
l=[0,0]
if p%gcd(w,d)!=0:
    print(-1)
else:
    m=exgcd(w,d,l)
    l[0]=p*l[0]//m
    l[1]=p*l[1]//m
    if l[0]<0 and l[1]<0:
        print(-1)
        sys.exit()
    if l[0]>=0 and l[1]>=0 and l[1]+l[0]<=n:
        print(l[0],end=" ")
        print(l[1],end=" ")
        print(n-l[0]-l[1])
        sys.exit()
    if l[0]+l[1]>n and w==d:
        print(-1)
        sys.exit()
    if p==0:
        print(0,end=" ")
        print(0,end=" ")
        print(n)
        sys.exit()
    else:
        if l[0]<0 and l[1]>=0:
            sum=l[0]*m//d-1
            l[1]+=w*sum//m
            l[0]-=sum*d//m
            if l[1]<0:
                print(-1)
                sys.exit()
        if l[1]<0 and l[0]>=0:
            sum=l[1]*m//(-w)+1
            l[0]-=d*sum//m
            l[1]+=w*sum//m
            if l[0]<0:
                print(-1)
                sys.exit()
        if l[0]+l[1]<=n and l[0]>=0 and l[1]>=0:
            print(l[0],end=" ")
            print(l[1],end=" ")
            print(n-l[0]-l[1])
            sys.exit()
        else:
            num,tag=(w-d)//m,0
            cnt=(n-l[0]-l[1])//num
            for i in range(cnt-100,cnt+100):
                res1=int(l[0]-d*i//m)
                res2=int(l[1]+w*i//m)
                if res1+res2<=n and res1>=0 and res2>=0:
                    print(res1,end=" ")
                    print(res2,end=" ")
                    print(n-res1-res2)
                    sys.exit()
            print(-1)

import sys

def gcd(a,b):
    if 0==b:
        return a
    else:
        return gcd(b,a%b)

def lcm(a,b):
    return a*b//gcd(a,b)

def exgcd(a,b,X,Y):
    if 0==b:
        X[0]=1
        Y[0]=0
        return a
    g=exgcd(b,a%b,Y,X)
    Y[0]-=a//b*X[0]
    return g

def ceil(x,y):
    return (x+y-1)//y

def main():
    #sys.stdin=open('in.txt','r')
    n,p,w,d=map(int,input().split())
    if 0==p:
        print('0 0 %d'%n)
        return
    g=gcd(w,d)
    if p%g!=0:
        print('-1')
        return
    X=[0]
    Y=[0]
    exgcd(w,d,X,Y)
    x=X[0]*p//g
    y=Y[0]*p//g
    k1=lcm(w,d)//w
    k2=lcm(w,d)//d

    if x<0:
        t=ceil(abs(x),k1)
        x=x+k1*t
        y=y-k2*t
    else:
        t=x//k1;
        x=x-k1*t
        y=y+k2*t

    if y<0:
        print('-1')
        return

    t=y//k2
    x=x+k1*t
    y=y-k2*t

    if 0<=x<=n and 0<=y<=n and x+y<=n:
        print(x,y,n-x-y)
    else:
        print('-1')

main()

n,p,w,d=map(int, input().split(' '))
x=p//w
for y in range(0,w):
    if((y*d - p%w)%w==0):
        x-=((y*d-p%w)//w)
        break
z=n-x-y
if(x+y<=n and y<w and x>=0 and x*w+y*d==p):
    print("%d %d %d"%(x,y,z))
else:
    print("-1")

import math

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)

def exgcd(a, b, X, Y):
    if a == 0 and b == 0:
        return -1
    if b == 0:
        X[0] = 1
        Y[0] = 0
        return a
    d = exgcd(b, a % b, Y, X)
    Y[0] = Y[0] - a // b * X[0]
    return d

def fceil(x, y):
    return (x + y - 1) // y

def main():
    n, p, w, d = map(int, input().split());
    x = [0]
    y = [0]
    G = gcd(w, d)
    if p % G != 0:
        print(-1)
        return
    if p % w == 0:
        x[0] = p // w
        if x[0] <= n:
            print(x[0], 0, n - x[0])
            return
    if p % d == 0:
        y[0] = p // d
        if y[0] <= n:
            print(0, y[0], n - y[0])
            return
    exgcd(w, d, x, y)
    x[0] = x[0] * p // G
    y[0] = y[0] * p // G
    if x[0] < 0:
        t = fceil(abs(x[0]), d)
        x[0] = x[0] + d * t
        y[0] = y[0] - w * t
    if y[0] < 0:
        t = fceil(abs(y[0]), w)
        x[0] = x[0] - d * t
        y[0] = y[0] + w * t
    if x[0] < 0 or y[0] < 0:
        print(-1)
        return
    t = y[0] // w
    x[0] = x[0] + d * t
    y[0] = y[0] - w * t
    if x[0] + y[0] > n:
        print(-1)
        return
    z = n - x[0] - y[0]
    print(x[0], y[0], z)

main()

import math
def main():
    noofgames,points,winpoints,drawpoints = map(int,input().split())
    common         = math.gcd(winpoints,drawpoints)
    if points == 0:
        print(0,0,noofgames)
        return
    if points%common:
        print(-1)
        return
    if common != 1 :
        points //= common
        winpoints //= common
        drawpoints //= common
    for i in range(winpoints):
        if drawpoints*i > points :
            print(-1)
            return
        a = (points - drawpoints*i)
        b = a%winpoints
        if a >= 0 and b == 0 :
            x = a//winpoints
            y = i
            z = noofgames - x - y
            if z >= 0 :
                print(x,y,z)
                return
    print(-1)
    return
main()

n, p, w, d = map(int, input().split())
for y in range(w):
    if (p - y*d) % w == 0 and y <= (p - y*d) // w + y <= n:
        x = (p - y*d) // w
        z = n - x - y
        print(x, y, z)
        break
else:
    print(-1)

n,p,w,d = map(int,input().split())

if w * n < p:
    print(-1)
    exit()

for i in range(w) :
    if d * i > p :
        print(-1)
        exit()
    if ( p - d * i ) % w  == 0:
        q = (p - d * i )//w
        if i+q <= n :
            print(q,i,n-q-i)
            exit()

print(-1)

def results(arr):
    if arr[0]*arr[2] < arr[1]:
        print (-1)
    elif arr[1] == 0:
        print (0,0,arr[0])
    elif arr[0] == arr[1] and arr[1]%arr[2]!=0 and arr[1]%arr[3]!=0:
        print(-1)
    else:
        x = max(arr[2],arr[3])
        y = arr[2] if x == arr[3] else arr[3]
        divLimit = arr[1]//x
        while 1:
            interim = arr[1] - divLimit*x
            if interim%y == 0:
                if interim//y + divLimit <= arr[0]:
                    if x == arr[2]:
                        if divLimit >=0 and interim//y >=0:
                            print (divLimit,interim//y,arr[0] - divLimit-interim//y)
                        else:
                            print (-1)
                        break
                    else:
                        if divLimit >=0 and interim//y >=0:
                            print (interim//y,divLimit,arr[0] - divLimit-interim//y)
                        else:
                            print (-1)
                        break
            else:
                divLimit -= 1
results(list(map(int,input().split())))

#------------------------template--------------------------#
import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import*
from io import BytesIO, IOBase
def vsInput():
    sys.stdin = open('input.txt', 'r')
    sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
ALPHA='abcdefghijklmnopqrstuvwxyz'
M=1000000007
EPS=1e-6
def value():return tuple(map(int,input().split()))
def array():return [int(i) for i in input().split()]
def Int():return int(input())
def Str():return input()
def arrayS():return [i for i in input().split()]

#-------------------------code---------------------------#
# vsInput()

for _ in range(1):
    n,p,w,d=value()

    # w*x + d*y =p

    if(w==1):
        if(p>n):
            print(-1)
        else:
            print(p,0,n-p)

    else:

        for draws in range(w+1):

            rem_score=p-draws*d
            wins=rem_score//w

            loose=n-wins-draws

            if(loose>=0 and wins+draws<=n and rem_score%w==0 and wins>=0):
                print(wins,draws,loose)
                exit()

        if(p==0):
            print(0,0,n)
        else:
            print(-1)

n, p, w, d = list(map(int, input().split()))
if n * w >= p:
	a, b = max(w, d), min(w, d)
	while b:
		b, a = a % b, b
	nod = a
	if not p % nod:
		r, i, x, y = 0, 0, 0, 0
		while r != p:
			x = p // w - i
			y = (p - x * w) // d
			r = x * w + y * d
			i += 1
			if i > n or x < 0 or y < 0 or x + y > n:
				print(-1)
				break
		else:
			z = n - x - y
			print(x, y, z)
	else: print(-1)
else: print(-1)

#!/usr/bin/env pypy
from __future__ import division, print_function
from collections import defaultdict, Counter, deque
from future_builtins import ascii, filter, hex, map, oct, zip
from random import randint
from itertools import imap as map, izip as zip, permutations, combinations, combinations_with_replacement
from __builtin__ import xrange as range
from math import ceil, log
from _continuation import continulet
from cStringIO import StringIO
from io import IOBase
import __pypy__
from bisect import bisect, insort, bisect_left, bisect_right
import sys
import os
import re
inf = float('inf')
mod = int(1e9) + 7
mod_ = 998244353
N = int(1e5) + 5

'''
Check for special cases (n=1)
One wrong submission = 10 mins penalty!
do smth instead of nothing and stay organized
'''

def main():
	games_played, actual_score, points_per_win, points_per_draw = map(int, input().split())

	# we assume that we won all games
	assumed_score = games_played*points_per_win
	wins = games_played
	draws = 0
	losses = 0

	for _ in range(N):
		if (assumed_score - actual_score) % points_per_win == 0:
			# extra score is divisible by ppw
			# then we can add that to losses
			break
		else:
			# otherwise we add that to draws
			draws += 1
			wins -= 1
			assumed_score -= points_per_win
			assumed_score += points_per_draw

	else:
		# if we never were able to divide the extra score in losses
		print(-1)
		exit()

	# otherwise divide up the extra score in losses
	extra_score = assumed_score - actual_score
	wins -= extra_score//points_per_win
	losses += extra_score//points_per_win

	if wins >= 0 and losses >= 0 and draws >= 0:
		print(wins, draws, losses)
	else:
		print(-1)

BUFSIZE = 8192
class FastI(IOBase):
	def __init__(self, file):
		self._fd = file.fileno()
		self._buffer = StringIO()
		self.newlines = 0

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count("\n") + (not b)
			ptr = self._buffer.tell()
			self._buffer.seek(0, 2), self._buffer.write(
				b), self._buffer.seek(ptr)
		self.newlines -= 1
		return self._buffer.readline()
class FastO(IOBase):
	def __init__(self, file):
		self._fd = file.fileno()
		self._buffer = __pypy__.builders.StringBuilder()
		self.write = lambda s: self._buffer.append(s)

	def flush(self):
		os.write(self._fd, self._buffer.build())
		self._buffer = __pypy__.builders.StringBuilder()
def print(*args, **kwargs):
	sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop("end", "\n"))
	if kwargs.pop("flush", False):
		file.flush()
def gcd(x, y):
	while y:
		x, y = y, x % y
	return x
sys.stdin, sys.stdout = FastI(sys.stdin), FastO(sys.stdout)
def input(): return sys.stdin.readline().rstrip("\r\n")
if __name__ == "__main__":
	def bootstrap(cont):
		call, arg = cont.switch()
		while True:
			call, arg = cont.switch(to=continulet(
				lambda _, f, args: f(*args), call, arg))
	cont = continulet(bootstrap)
	cont.switch()
	main()

N, P, W, D = map(int, raw_input().split())

def gcdExtended(a, b):
    if a == 0:
        return (b, (0, 1))
    g, newPair = gcdExtended(b % a, a)
    return (g, (newPair[1] - b / a * newPair[0], newPair[0]))

gcd, pair = gcdExtended(W, D)
#print gcd, pair, "<-----"

if P % gcd > 0:
    print -1
else:
    K = P / gcd
    f1, f2 = D / gcd, W / gcd
    pair = [pair[0] * K, pair[1] * K]

    if pair[0] < 0:
        t = (-pair[0] + f1 - 1) / f1
        pair = [pair[0] + t * f1, pair[1] - t * f2]

    if pair[1] < 0:
        t = (-pair[1] + f2 - 1) / f2
        pair = [pair[0] - t * f1, pair[1] + t * f2]

    if min(pair) >= 0 and sum(pair) > N:
        t = (sum(pair) - N + f2 - f1 - 1) / (f2 - f1)
        pair = [pair[0] + t * f1, pair[1] - t * f2]

    if min(pair) >= 0 and sum(pair) <= N:
        print pair[0], pair[1], N - sum(pair)
    else:
        print -1

''' CODED WITH LOVE BY SATYAM KUMAR '''

from sys import stdin, stdout
import heapq
import cProfile, math
from collections import Counter, defaultdict, deque
from bisect import bisect_left, bisect, bisect_right
import itertools
from copy import deepcopy
from fractions import Fraction
import sys, threading
import operator as op
from functools import reduce
import sys

sys.setrecursionlimit(10 ** 6)  # max depth of recursion
threading.stack_size(2 ** 27)  # new thread will get stack of such size
fac_warm_up = False
printHeap = str()
memory_constrained = False
P = 10 ** 9 + 7

class MergeFind:
    def __init__(self, n):
        self.parent = list(range(n))
        self.size = [1] * n
        self.num_sets = n
        self.lista = [[_] for _ in range(n)]

    def find(self, a):
        to_update = []
        while a != self.parent[a]:
            to_update.append(a)
            a = self.parent[a]
        for b in to_update:
            self.parent[b] = a
        return self.parent[a]

    def merge(self, a, b):
        a = self.find(a)
        b = self.find(b)
        if a == b:
            return
        if self.size[a] < self.size[b]:
            a, b = b, a
        self.num_sets -= 1
        self.parent[b] = a
        self.size[a] += self.size[b]
        self.lista[a] += self.lista[b]

    def set_size(self, a):
        return self.size[self.find(a)]

    def __len__(self):
        return self.num_sets

def display(string_to_print):
    stdout.write(str(string_to_print) + "\n")

def prime_factors(n):  # n**0.5 complex
    factors = dict()
    for i in range(2, math.ceil(math.sqrt(n)) + 1):
        while n % i == 0:
            if i in factors:
                factors[i] += 1
            else:
                factors[i] = 1
            n = n // i
    if n > 2:
        factors[n] = 1
    return (factors)

def all_factors(n):
    return set(reduce(list.__add__,
                      ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

def fibonacci_modP(n, MOD):
    if n < 2: return 1
    return (cached_fn(fibonacci_modP, (n + 1) // 2, MOD) * cached_fn(fibonacci_modP, n // 2, MOD) + cached_fn(
        fibonacci_modP, (n - 1) // 2, MOD) * cached_fn(fibonacci_modP, (n - 2) // 2, MOD)) % MOD

def factorial_modP_Wilson(n, p):
    if (p <= n):
        return 0
    res = (p - 1)
    for i in range(n + 1, p):
        res = (res * cached_fn(InverseEuler, i, p)) % p
    return res

def binary(n, digits=20):
    b = bin(n)[2:]
    b = '0' * (digits - len(b)) + b
    return b

def is_prime(n):
    """Returns True if n is prime."""
    if n < 4:
        return True
    if n % 2 == 0:
        return False
    if n % 3 == 0:
        return False
    i = 5
    w = 2
    while i * i <= n:
        if n % i == 0:
            return False
        i += w
        w = 6 - w
    return True

def generate_primes(n):
    prime = [True for i in range(n + 1)]
    p = 2
    while p * p <= n:
        if prime[p]:
            for i in range(p * 2, n + 1, p):
                prime[i] = False
        p += 1
    return prime

factorial_modP = []

def warm_up_fac(MOD):
    global factorial_modP, fac_warm_up
    if fac_warm_up: return
    factorial_modP = [1 for _ in range(fac_warm_up_size + 1)]
    for i in range(2, fac_warm_up_size):
        factorial_modP[i] = (factorial_modP[i - 1] * i) % MOD
    fac_warm_up = True

def InverseEuler(n, MOD):
    return pow(n, MOD - 2, MOD)

def nCr(n, r, MOD):
    global fac_warm_up, factorial_modP
    if not fac_warm_up:
        warm_up_fac(MOD)
        fac_warm_up = True
    return (factorial_modP[n] * (
            (pow(factorial_modP[r], MOD - 2, MOD) * pow(factorial_modP[n - r], MOD - 2, MOD)) % MOD)) % MOD

def get_int():
    return int(stdin.readline().strip())

def get_tuple():
    return map(int, stdin.readline().split())

def get_list():
    return list(map(int, stdin.readline().split()))

memory = dict()

def clear_cache():
    global memory
    memory = dict()

def cached_fn(fn, *args):
    global memory
    if args in memory:
        return memory[args]
    else:
        result = fn(*args)
        memory[args] = result
        return result

def ncr(n, r):
    return math.factorial(n) / (math.factorial(n - r) * math.factorial(r))

def binary_search(i, li):
    fn = lambda x: li[x] - x // i
    x = -1
    b = len(li)
    while b >= 1:
        while b + x < len(li) and fn(b + x) > 0:  # Change this condition 2 to whatever you like
            x += b
        b = b // 2
    return x

# -------------------------------------------------------------- MAIN PROGRAM

TestCases = False
optimise_for_recursion = True  # Can not be used clubbed with TestCases WHen using recursive functions, use Python 3

def main():
    n, p, w, d = get_tuple()
    gcd = math.gcd(w, d)
    if p%gcd ==0:
        p, w, d = p//gcd, w//gcd, d//gcd
        #print(p, w, d, gcd)
        for x in range(d):
            if (p - (x * w))%d == 0:
                y = (p - (x * w))//d
                if y<0: break
                #print(x, y)
                k = y//w
                y = y - k*w
                x = x + k*d
                if (x+y)<=n:
                    print(x , y, n - (x + y))
                    return
                break
    print(-1)

# --------------------------------------------------------------------- END=

if TestCases:
    for i in range(get_int()):
        main()
else:
    main() if not optimise_for_recursion else threading.Thread(target=main).start()

import math
import sys

def exgcd(a, b):
    if b == 0:
        return (1, 0)
    else:
        y, x = exgcd(b, a % b)
        y -= x * (a // b)
        return (x, y)

def ceil(x, y):
    return x // y + (x % y != 0)

def output(a, b, n):
    if a < 0 or b < 0:
        return
    if a + b > n:
        return

    print(a, b, n - a - b)
    sys.exit(0)

def main():
    n, p, w, d = [int(x) for x in input().split(' ')]
    g = math.gcd(w, d)
    if p % g != 0:
        print(-1)
        return
    x, y = exgcd(w, d)
    a = w // g
    b = d // g
    g = p // g
    x *= g
    y *= g

    if x < 0:
        t = ceil(-x, b)
        x += t * b
        y -= t * a
    elif y < 0:
        t = ceil(-y, a)
        x -= t * b
        y += t * a

    if x < 0 or y < 0:
        print(-1)
    else:
        #output(x, y, n)
        #output(x % b, y + (x // b) * a, n)
        output(x + (y // a) * b, y % a, n)
        print(-1)

if __name__ == '__main__':
    main()

from fractions import gcd
n,p,w,d=map(int,raw_input().split())
if p%gcd(p,w):
    print -1
    exit()
for i in range(w):
    temp=p-(i*d)
    if temp>=0 and temp%w==0 and (i+(temp/w))<=n:
        print temp/w,i,(n-(i+(temp/w)))
        exit()
print -1

def exgcd(a,b,x,y):
    if b==0:
        x[0]=1
        y[0]=0
        return a
    r=exgcd(b,a%b,y,x)
    y[0]-=(a//b)*x[0]
    return r;

def min_ans(a,b,x,y,n):
    g=exgcd(a,b,x,y)
    if n%g:
        return 0
    x[0]*=n//g
    y[0]*=n//g
    db=b//g
    x[0]=((x[0]%db)+db)%db
    y[0]=(n-a*x[0])//b;
    return g
s=input().split()
n=int(s[0])
p=int(s[1])
w=int(s[2])
d=int(s[3])
x=[0]
y=[0]
g=min_ans(w,d,x,y,p)
x=x[0]
y=y[0]
if g==0:
    print("-1")
else:
    if y<0:
        print("-1")
    elif x+y>n:
        da=w//g
        db=d//g
        if db>=da:
            print("-1")
        else:
            tmp=x+y-n
            tmp=(tmp+da-db-1)//(da-db)
            x+=tmp*db
            y-=tmp*da
            if 0<=x and x<=n and 0<=y and y<=n and 0<=x+y and x+y<=n:
                print("%d %d %d"%(x,y,n-x-y))
            else:
                print("-1")
    else:
        print("%d %d %d"%(x,y,n-x-y))

import math
def egcd(a, b):
    if a == 0:
        return (b, 0, 1)
    else:
        g, x, y = egcd(b % a, a)
        return (g, y - (b // a) * x, x)

from math import gcd
def isPossible(a, b, c):
    return (c % gcd(a, b) == 0)

n, c, a, b = [int(x) for x in input().split()]
if isPossible(a, b, c):
    X = egcd(a, b)
    # print(X)
    g = X[0]
    x = X[1] * c // g
    y = X[2] * c // g
    # k = -1
    # print(x, y)
    l = int(math.ceil(-1 * y * g / a - 1e-8))
    h = int(min(math.floor(x * g / b + 1e-8), math.floor((n - x - y) * g / (a - b) + 1e-8)))
    # h = math.floor(h)
    # print("l, h: ", l, h)
    if l > h: print(-1)
    else:
        if h - 1 < h and h - 1 >= l: h = h - 1
        x = x - ((h * b) // g)
        y = y + ((h * a) // g)
        z = n - x - y
        print(x, y, z)
else: print(-1)

import math
import sys

def exgcd(a, b):
    if b == 0:
        return (1, 0)
    else:
        y, x = exgcd(b, a % b)
        y -= x * (a // b)
        return (x, y)

def ceil(x, y):
    return x // y + (x % y != 0)

def output(a, b, n):
    if a < 0 or b < 0:
        return
    if a + b > n:
        return

    print(a, b, n - a - b)
    sys.exit(0)

def main():
    n, p, w, d = [int(x) for x in input().split(' ')]
    g = math.gcd(w, d)
    if p % g != 0:
        print(-1)
        return
    x, y = exgcd(w, d)
    a = w // g
    b = d // g
    g = p // g
    x *= g
    y *= g

    if x < 0:
        t = ceil(-x, b)
        x += t * b
        y -= t * a
    elif y < 0:
        t = ceil(-y, a)
        x -= t * b
        y += t * a

    if x < 0 or y < 0:
        print(-1)
    else:
        output(x, y, n)
        output(x % b, y + (x // b) * a, n)
        output(x + (y // a) * b, y % a, n)
        print(-1)

if __name__ == '__main__':
    main()

from __future__ import division, print_function
def main():
    n,p,w,d=map(int,input().split())
    wins=0
    def gcd(a,b):
        while b:
            a,b=b,a%b
        return a
    lcm=(w*d)//gcd(w,d)
    x=lcm//w
    while (wins*w)<=lcm and wins<n and (p-wins*w)%d!=0:
        wins+=1
    if (p-wins*w)%d==0:
        wins+=x*((p-wins*w)//lcm)
        draws=(p-wins*w)//d

        if wins+draws<=n and draws>=0 and wins>=0 and ((wins*w)+(draws*d))==p:
            print(wins,draws,n-wins-draws)
        else :
            print(-1)
    else :
        print(-1)

######## Python 2 and 3 footer by Pajenegod and c1729

# Note because cf runs old PyPy3 version which doesn't have the sped up
# unicode strings, PyPy3 strings will many times be slower than pypy2.
# There is a way to get around this by using binary strings in PyPy3
# but its syntax is different which makes it kind of a mess to use.

# So on cf, use PyPy2 for best string performance.

py2 = round(0.5)
if py2:
    from future_builtins import ascii, filter, hex, map, oct, zip
    range = xrange

import os, sys
from io import IOBase, BytesIO

BUFSIZE = 8192
class FastIO(BytesIO):
    newlines = 0

    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0,2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        while self._fill(): pass
        return super(FastIO,self).read()

    def readline(self):
        while self.newlines == 0:
            s = self._fill(); self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.getvalue())
            self.truncate(0), self.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            self.write = lambda s:self.buffer.write(s.encode('ascii'))
            self.read = lambda:self.buffer.read().decode('ascii')
            self.readline = lambda:self.buffer.readline().decode('ascii')

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip('\r\n')

# Cout implemented in Python
import sys
class ostream:
    def __lshift__(self,a):
        sys.stdout.write(str(a))
        return self
cout = ostream()
endl = '\n'

# Read all remaining integers in stdin, type is given by optional argument, this is fast
def readnumbers(zero = 0):
    conv = ord if py2 else lambda x:x
    A = []; numb = zero; sign = 1; i = 0; s = sys.stdin.buffer.read()
    try:
        while True:
            if s[i] >= b'0' [0]:
                numb = 10 * numb + conv(s[i]) - 48
            elif s[i] == b'-' [0]: sign = -1
            elif s[i] != b'\r' [0]:
                A.append(sign*numb)
                numb = zero; sign = 1
            i += 1
    except:pass
    if s and s[-1] >= b'0' [0]:
        A.append(sign*numb)
    return A

if __name__== "__main__":
  main()

n,p,w,d=map(int,input().strip().split())
x = -1
y = -1
for i in range(0, w):
    if (p - d*i) % w == 0:
        y = i
        x = int((p -d*y) / w)
        break

if x < 0 or y < 0 or x+y > n:
    print(-1)
else:
    print(x, y, n-(x+y))

import math

def egcd(a,b):
	if a==0:
		return (b,0,1)
	else:
		gcd,x,y=egcd(b%a,a)
		return (gcd,y-(b//a)*x,x)

n,p,w,d=map(int,input().split())
g,x0,y0=egcd(w,d)
# print(g,)
if(p%g):
	print(-1)
	exit(0)
x0*=(p//g)
y0*=(p//g)
# print(x0*w+y0*d)
# print(x0,y0)
minn=max(-x0*g/d,(x0+y0-n)*g/(w-d))
maxx=y0*g/w
# print(minn,maxx)
l=math.ceil(minn)
r=math.floor(maxx)
# print(l,r)
if r<l:
	print(-1)
	exit(0)
for i in range(l,r+1):
	x=(x0+i*d//g)
	y=(y0-i*w//g)
	z=n-x-y
	if x>=0 and y>=0 and z>=0:
		print((x),y,int(z))
		exit(0)
print(-1)

inp = [int(x) for x in input().split()]
n = inp[0]
p = inp[1]
w = inp[2]
d = inp[3]
if p == 0:
    print(0,0,n)
    exit(0)

# n_temp = n
# mi = p + 1

p_temp = p
sum_w = 0
ans_x = 0
ans_y = 0
ans_z = 0

found = False
osztok = {}

while p_temp > 0:
    if p_temp % w != 0:
        if (p_temp%w) in osztok:
            break
        osztok[p_temp%w] = 1
        p_temp -= d
        ans_y += 1
    else:
        found = True
        break

# print(osztok)

# while (p_temp - w)> -1:
#     sum_w += 1
#     if (p_temp - w) % d == 0:
#         # print(p_temp - w)
#         mi = p_temp - w
#         ans_x = sum_w
#     p_temp -= w

# if mi != (p + 1):
# print(ans_y, p)
if found:
    # ans_y = p - (ans_x * w)
    ans_x = p_temp // w
    ans_z = n - ans_x - ans_y
    if ans_x + ans_y > n :
        # print(ans_x, ans_y)
        print(-1)
        exit(0)
elif p % d == 0:
    ans_y = p // d
    ans_z = n - ans_y
    if ans_y <= n:
        print(ans_x, ans_y, ans_z)
        exit(0)
else:
    print(-1)
    exit(0)

if ans_x * w + ans_y * d == p:
    print(ans_x, ans_y, ans_z)
else:
    print(-1)

import math
def gcd(a,b):
    if a==0:
        x0=0
        y0=1
        return b,x0,y0
    d=gcd(b%a,a)
    x0=d[2]-(b//a)*d[1]
    y0=d[1]
    return d[0],x0,y0

s=list(map(int,input().split()));
n=s[0]
p=s[1]
w=s[2]
d=s[3]
dd=gcd(w,d)
x0=dd[1]
y0=dd[2]
dd=dd[0]
x0*=p//dd
y0*=p//dd
dy=w//dd
dx=d//dd
if p%dd !=0:
    print(-1,flush=False)
    exit()
else:
    if y0<0:
        col=math.ceil(abs(y0)/dy)
        y0+=dy*col
        x0-=dx*col
    col=y0//dy
    y0-=dy*col
    x0+=dx*col
    if x0<0:
        print(-1,flush=False)
        exit()
    if(x0+y0<=n):
        print(x0,y0,n-x0-y0,flush=False)
    else:
        print(-1,flush=False)

import os
import sys
from collections import defaultdict as ddic, Counter, deque
from itertools import combinations, permutations, product

FAST_INPUT = 0
if FAST_INPUT:
    from atexit import register
    from io import BytesIO

    sys.stdin = BytesIO(os.read(0, os.fstat(0).st_size))
    sys.stdout = BytesIO()
    register(lambda: os.write(1, sys.stdout.getvalue()))

rr = lambda: sys.stdin.readline().rstrip('\r\n')
rri = lambda: int(rr())
rrm = lambda: map(int, rr().split())
MOD = 10**9 + 7

#####

def egcd(a, b):
    if a == 0:
        return (b, 0, 1)
    else:
        g, y, x = egcd(b % a, a)
        return (g, x - (b // a) * y, y)

def solve(N, P, W, D):
    # win, +=W
    # draw, both +=D
    # solve x*W + y*D = P or xA + yB = C
    #     0 <= x+y <= n
    A, B, C = W, D, P
    from fractions import gcd
    g = gcd(gcd(A, B), C)
    A /=g
    B /=g
    C /=g
    g,x,y = egcd(A, B)
    x *= C
    y *= C
    # can x+=B y-=A or opposite
    #print 'working', x, y, ';', A, B, C, ';n', N
    if x < 0:
        if B > 0:
            for e in range(64, -1, -1):
                factor = 1 << e
                if x + factor * B <= 0:
                    x += factor*B
                    y -= factor*A
            while x + B <= 0:
                x += B
                y -= A
            if x < 0:
                x += B
                y -= A
            if y < 0: return
        elif B < 0:
            for e in range(64, -1, -1):
                factor = 1 << e
                if x - factor * B <= 0:
                    x -= factor*B
                    y += factor*A
            while x - B <= 0:
                x -= B
                y += A
            if x < 0:
                x -= B
                y += A
            if y < 0: return
    if y < 0:
        if A > 0:
            for e in range(64, -1, -1):
                factor = 1 << e
                if y + factor * A <= 0:
                    x -= factor*B
                    y += factor*A
            #print 'Y', y, y+A, A
            while y + A <= 0:
                x -= B
                y += A
            if y < 0:
                x -= B
                y += A
            #print 'at', x,y, ';', A, B
            if x < 0: return
        elif A < 0:
            for e in range(64, -1, -1):
                factor = 1 << e
                if y - factor * A <= 0:
                    x += factor*B
                    y -= factor*A
            while y - A <= 0:
                x += B
                y -= A
            if y < 0:
                x += B
                y -= A
            #print 'at', x,y, ';', A, B
            if x < 0: return

    if 0 <= x + y <= N and A*x + B*y == C:
        return x,y,N-x-y
    if x+y > N:
        # try to put more coefficient on larger weight
        diff = x+y-N

        if A > B:
            q,r = divmod(diff, A-B)
            q += r>0
            x += B * q
            y -= A * q
        elif B > A:
            q,r = divmod(diff, B-A)
            q += r>0
            x -= B * q
            y += A * q
        else:
            # A==B==1
            pass
        if 0 <= x <= N >= y >= 0 and 0 <= x+y<= N:
            if A*x + B*y == C:
                return x,y,N-x-y

    return

DEBUG = 0
if DEBUG:
    import random;random.seed(0);ri=random.randint

    for trials in range(100):
        D = ri(1, 5000000)
        W = ri(1, 5000000)

        # solve x*W + y*D = P or xA + yB = C
        #     0 <= x+y <= n

        X = ri(1, 5000000)
        Y = ri(1, 5000000)
        P = X*W + Y*D
        N = X+Y+ri(0, 10)
        ans = solve(N, P, W, D)
        if ans is not None:
            x,y,z = ans
            if not(x*W+y*D==P and 0<=x<=N>=y>=0 and 0<=x+y<=N):
                print 'oops', N, P, W, D
                break
        print '.',
    print 'done'

ans = solve(*rrm())
if ans is None:
    print -1
else:
    print " ".join(map(str, ans))

import math
n,p,w,d=list(map(int,input().split()))
def gcd(a,b):
    if(a==0):
        return (b,0,1)
    d,x1,y1 = gcd(b%a,a)
    return d,y1-(b//a)*x1,x1
g,x,y=gcd(w-d,w)

if(p<w):
    if(p%d == 0):
        y = p//d
        z = n-y
        print(0,y,z)
    else:
        print(-1)
elif(p==w):
    x=1
    z=n-x
    print(x,0,z)
else:
    if(n*w-p<0 or (n*w-p)%g):
        print(-1)
    else:
        x*=(n*w-p)//g
        y*=(n*w-p)//g
        #print('x_0:',x)
        #print('y_0:',y)

        while(True):
            aa=math.floor(x/w)
            x-=aa*w
            y+=(w-d)*aa
            #print('x :',x)
            #print('y :',y)
            if(x>=0 and y>=0):
                if(not (n-x-y>=0)):
                    print(-1)
                    break
                else:
                    print(n-x-y,x,y)
                    break

        #print('x_1:',x)
        #print('y_1:',y)

        #if(x>=0 and y>=0):
        #    print(n-x-y,x,y)
        #else:
        #    print(n-x-y,x,y)
        #    print(-1)

rr = raw_input
rri = lambda: int(rr())
rrm = lambda: map(int, rr().split())

def solve(N, C, A, B):
    for y in xrange(A):
        if (y * B - C) % A == 0:
            x = (C - y*B) / A
            if x >= 0 and N-x-y >= 0:
                return x, y, N-x-y
    return -1,

print " ".join(map(str, solve(*rrm())))

import math
import random

n, p, w, d = map(int, input().split())

output = []

c = (p - d * n) / (w - d)
c = math.ceil(c)

for b in range(d + 1):

	if (p - b * w) % d == 0:
		lower = (c - b) / d
		upper = (n - b) / d

		if lower > 0:
			a = math.ceil(lower)

		else:
			a = 0

		condition = True

		while condition == True:

			x = d * a + b

			if (p - x * w) >= 0:
				y = (p - x * w) / d

				if int(y) == y:
					y = int(y)
					z = n - x - y

					if z >= 0:
						output = [x, y, z]
						condition = False
			a += 1

			if a > upper:
				condition = False

	if len(output) == 3:

		if x + y + z == n:
			print(x, y, z)
			break

else:
	print(-1)

import sys
from fractions import gcd
n, p, w, d = [int(item) for item in input().split()]
div = gcd(w, d)
if p % div != 0:
    print(-1)
else:
    p //= div
    w //= div
    d //= div
    ans = False
    for x in range(p // w, max(-1, p // w - 10**5), -1):
        if (p - x * w) % d != 0:
            continue
        y = (p - x * w) // d
        if y < 0 or x + y > n:
            continue
        ans = True
        break
    if ans:
        print(x, y, n - x - y)
    else:
        print(-1)

import sys
sys.setrecursionlimit(1000000)

def xgcd(a, b):
    """return (g, x, y) such that a*x + b*y = g = gcd(a, b)"""
    if b == 0:
        return (a, 1, 0)
    else:
        g, x, y = xgcd(b, a%b)
        return (g, y, x- (a // b) * y)

n,p,w,d=map(int,input().split());
g,x,y=xgcd(w,d);

if p%g:
  print(-1);
  sys.exit(0);

if g<0:
  g*=-1;
x*=p//g;
y*=p//g;

t=0;
if x<0:
  t=(0-x)*g//d+(0 if (0-x)*g%d == 0 else 1);
  x+=t*d//g;
  y-=t*w//g;

if y<0:
  t=(0-y)*g//w+(0 if (0-y)*g%w==0 else 1);
  x-=t*d//g;
  y+=t*w//g;

if n-(x+y)<0:
  t=(n-(x+y))*g//(d-w) + (0 if (n-(x+y))*g%(d-w)==0 else 1);
  x+=t*d//g;
  y-=t*w//g;

if x<0 or y<0 or n-x-y<0:
  print(-1)
else:
  print(x,y,n-x-y)

N = 10**5 + 3

def main():
    n,p,w,d = map(int,input().split())

    x_max = p//w
    for i in range(N):
        x = x_max-i
        if x<0:
            break

        rem = p-x*w
        if rem%d == 0:
            y = rem//d
            if x+y <= n:
                z = n-x-y
                print(x,y,z)
                return

    print(-1)

if __name__ == "__main__":
    main()

n,p,w,d=map(int,input().split())
if n*w<p or (p>0 and p<d):
    print(-1)
elif (p%w==0 and p//w<=n) or (p%d==0 and p//d<=n):
    if p%w==0:
        print(p//w,0,n-p//w)
    else:
        print(0,p//d,n-p//d)
else:
    total=0
    i=0
    total=int(p/w)*w
    i=int(p/w)
    dif=p-total
    if dif==0:
        print(i,0,n-i)
    elif dif%d==0:
        print(i,dif//d,n-i-dif//d)
    else:
        if w%d==0:
            print(-1)
        else:
            while dif%d!=0:
                dif+=w
                i-=1
            print(i,dif//d,n-i-dif//d)

def fastpow(a, p, m):
	if a==0:
		return 1
	t=fastpow(a,p//2)
	return t*t*(a if a%2 else 1)

def xgcd(a,b):
	if b==0:
		return (1,0,abs(a))
	x,y,g=xgcd(b,a%b)
	return (y,x-(a//b)*y,g);

def adjust_xgcd_lb(x,y,g,a,b,lbx,lby):
	if x<lbx:
		t=0
		if b>=0:
			t=(lbx-x)*g//b + int((lbx-x)*g%b!=0)
		else:
			t=(lbx-x)*g//b
		x+=t*b//g;
		y-=t*a//g;
	if y<lby:
		t=0
		if a>=0:
			t=(lby-y)*g//a + int((lby-y)*g%a!=0)
		else:
			t=(lby-y)*g//a
		x-=t*b//g;
		y+=t*a//g;
	#if x<lbx or y<lby:
	#	raise Exception;
	return (x,y);

n,p,w,d=map(int,input().split())
x,y,g=xgcd(w,d)

if p%g:
  print(-1)
  exit(0)
x*=p//g
y*=p//g

x,y=adjust_xgcd_lb(x,y,g,w,d,0,0)
if n-(x+y)<0:
  t=(n-(x+y))*g//(d-w) + int((n-(x+y))*g%(d-w)!=0)
  x+=t*d//g
  y-=t*w//g
if x<0 or y<0 or n-x-y<0:
	print(-1)
else:
	print( x,y,n-x-y)

n,p,w,d=map(int,input().split())
y=0
while y<w and p%w:y+=1;p-=d
z=n-p//w-y
print(*((p//w,y,z),[-1])[y==w or(p|z)<0])

##for debug comment out
import sys,atexit
from io import BytesIO
inp = BytesIO(sys.stdin.buffer.read())
input = lambda:inp.readline().decode('ascii').strip()
buf = BytesIO()
#sys.stdout.write = lambda s: buf.write(s.encode('ascii'))
#print = lambda s: buf.write(s.encode('ascii'))
atexit.register(lambda:sys.__stdout__.buffer.write(buf.getvalue()))

n,p,w,d=map(int,input().split())
x=-1
y=-1
for i in range(10**5):
    if (p-i*d)%w==0:
        y=i
        x=(p-y*d)//w

        break

if x<0 or y<0 or x+y>n:
    print(-1)
else:
    print(x,y,n-x-y)

import math

def extended_euclid(a, b):
    """return (g, x, y) such that a*x + b*y = g = gcd(a, b)"""
    x0, x1, y0, y1 = 0, 1, 1, 0
    while a != 0:
        (q, a), b = divmod(b, a), a
        y0, y1 = y1, y0 - q * y1
        x0, x1 = x1, x0 - q * x1
    return b, x0, y0

n, p, w, d = [int(i) for i in input().split(' ')]

a = w
b = d
c = p

g, x, y = extended_euclid(a, b)

if c % g != 0:
	print("-1")
else:
	b //= g
	a //= g
	x = x * (c // g)
	y = y * (c // g)

	#f1 = math.ceil((-x) / b)
	f2 = y // a
	#print(f2)
# 	if y < 0 and f2 * a != y:
# 		f2 = f2 - 1
	#if f1 <= f2:
	x += f2 * b;
	y -= f2 * a;
	if x >= 0 and y >= 0 and x + y <= n:
		print(str(x) + " " + str(y) + " " + str(n-x-y))
	else:
		print("-1")
	#else:
	#	print("-1")

n,p,w,d=map(int,input().split())
y=0
temp=p-y*d
mark=0
while(temp>=0):
    if(temp%w==0):
        x=temp//w
        if(x+y<=n):
            print(x,y,n-x-y)
            mark=1
            break
    y+=1
    temp-=d
    if(y>w):
        break
if(mark==0):
    print(-1)

"""
T=int(input())
for _ in range(0,T):
    N=int(input())
    s=input()
    a,b=map(int,input().split())
    s=[int(x) for x in input().split()]

"""

n,p,w,d=map(int,input().split())

temp=-1

for i in range(0,w):
    if((p-(d*i))%w==0 and ((p-(d*i))//w)+i<=n and (p-(d*i))//w>=0):
        print((p-(d*i))//w,i,n-((p-(d*i))//w)-i)
        temp=1
        break

if(temp==-1):
    print(-1)

n,p,w,d = map(int, input().split())

x, y = -1, -1
for y in range(w):
  if y*d > p:
    continue

  if (p - y*d) % w == 0:
    x = (p-y*d) // w
    if x + y <= n:
      print (x, y, n-x-y)
      break
else:
  print(-1)

n,p,w,d = [int(j) for j in input().split()]
z = 0
for y in range(w):
    if((p-d*y)%w == 0 and (p-d*y)//w >=0 and (p-d*y)//w + y <=n):
        print((p-d*y)//w,y,n-y-(p-d*y)//w)
        z = 1
        break
if(z != 1):
    print(-1)

n,p,w,d=map(int,input().split())
ans=-1
for i in range(10**6):
    if p%w==0:
        ans=i
        break
    p-=d
    if p<0:
        break
if ans==-1:
    print(-1)
else:
    u=p//w
    if u+i<=n:
        print(u,i,n-u-i)
    else:
        print(-1)

n, p, w, d = map(int, input().split())
r = p % w
n1 = 0
for i in range(1, 100000):
    if (d * i) % w == r:
        n1 = i
        break
n2 = (p - d * n1) // w
n3 = 0
r1 = p % d
for i in range(1, 100000):
    if (w * i) % d == r1:
        n3 = i
        break
n4 = (p - w * n3) // d
if p == 0:
    print(0, 0, n)
elif p % w == 0 and p // w <= n:
    print(p // w, 0, n - p // w)
elif p % d == 0 and p // d <= n:
    print(0, p // d, n - p // d)
elif n2 >= 0 and n1 * d + n2 * w == p and n1 + n2 <= n:
    print(n2, n1, n - n1 - n2)
elif n4 >= 0 and n3 * w + n4 * d == p and n3 + n4 <= n:
    print(n3, n4, n - n3 - n4)
else:
    print(-1)

def exgcd(a,b):
    if b==0:
        return [1,0,a]
    res=exgcd(b,a%b)
    t=res[0]
    res[0]=res[1]
    res[1]=t
    res[1]-=a//b*res[0]
    return res
inp=input().split()
n=eval(inp[0])
p=eval(inp[1])
d=eval(inp[2])
w=eval(inp[3])
gg=exgcd(d,w)
g=gg[2]
x=gg[0]
y=gg[1]
de=1
if p%g!=0:
    print(-1)
else :
    dx=w//g
    dy=d//g
    x*=p//g
    y*=p//g
    de=-10
    x+=de*dx
    y-=de*dy
    if x>0:
        de=-(x//dx)
    else :
        de=y//dy
    x+=de*dx
    y-=de*dy
    if x<0 or y<0:
        print(-1)
    else :
        if dx>dy:
            de=-(x//dx)
        else :
            de=y//dy
        x+=de*dx
        y-=de*dy
        if x+y<=n:
            print(x,y,n-x-y)
        else :
            print(-1)

from math import *
from sys import *
from heapq import *
from collections import defaultdict
import os, sys
from io import IOBase, BytesIO
M=10**9+7
def pow(a,b):
    res=1
    while b>0:
        if b&1:
            res*=a
        a*=a
        b>>=1
    return res
def powmod(a,b,m):
    res=1
    while b>0:
        if b&1:
            res=((res*a)%m)
        a*=a
        b>>=1
    return res
def inv(a,m):
    return powmod(a,m-2,m)
def alldivisors(n) :
    list = []
    arr=[]
    for i in range(1, int(sqrt(n) + 1)) :
        if (n % i == 0) :
            if (n / i == i) :
                arr+=[i]
            else :
                arr+=[i]
                list.append(n//i)
    arr+=list[::-1]
    return arr
def primefactorisation(n):
    potentional_p = 3
    itog_list = defaultdict(int)
    if n % 2 == 0:
        itog_list[2] = 0
    while n % 2 == 0:
        n = n // 2
        itog_list[2] += 1
    while n - 1:
        if potentional_p > (n**0.5):
            itog_list[n] += 1
            return itog_list
        while n % potentional_p == 0:
            n = n // potentional_p
            itog_list[potentional_p] += 1
        potentional_p += 2
    return itog_list

def main():
    n,p,w,d=list(map(int,input().split()))
    gd=gcd(w,d)
    if p%gd==0:
        p=p//gd
        w=w//gd
        d=d//gd
    else:
        print(-1)
        exit(0)
    x_i=p/w
    y_i=p/d

    if y_i<x_i:
        x=0
        while 1:
            val=p-x*w
            if val%d==0:
                if val>=0 and n-x-val//d>=0:
                    print(x,val//d,n-x-val//d)
                    break
                else:
                    print(-1)
                    break
            x+=1
    else:
        #print("here")
        y=0
        while 1:
            val=p-y*d
            if val%w==0:

                if val>=0 and n-y-val//w>=0:
                    print(val//w,y,n-y-val//w)
                    break
                else:
                    print(-1)
                    break
            y+=1

BUFSIZE = 8192
class FastIO(BytesIO):
    newlines = 0

    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0,2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        while self._fill(): pass
        return super(FastIO,self).read()

    def readline(self):
        while self.newlines == 0:
            s = self._fill(); self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.getvalue())
            self.truncate(0), self.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s:self.buffer.write(s.encode('ascii'))
        self.read = lambda:self.buffer.read().decode('ascii')
        self.readline = lambda:self.buffer.readline().decode('ascii')

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip('\r\n')

if __name__ == '__main__':
    main()
#threading.Thread(target=main).start()

n, p, w, d = list(map(int, input().split()))

s = 0

if (n * w < p):
    print(-1)
elif (w % d == 0) and (p % d > 0):
    print(-1)
elif (p % w == 0):
    print(' '.join(map(str, [p // w, 0, n - p // w])))
else:
    min_wd = p // (w + d)
    for j in range(min_wd + 1):
        curr = p - j * (w + d)

        if (curr % w == 0) and (curr // w + 2 * j <= n):
            print(' '.join(map(str, [curr // w + j, j, n - 2 * j - curr // w])))
            s = 1
            break
        if (curr % d == 0) and (curr // d + 2 * j <= n):
            print(' '.join(map(str, [j, curr // d + j, n - 2 * j - curr // d])))
            s = 1
            break
    if (s == 0):
        print(-1)

from sys import stdin
from math import ceil, floor

def extgcd(a, b):
    if a == 0:
        return (b, 0, 1)
    g, x1, y1 = extgcd(b % a, a)
    x = y1 - (b // a) * x1
    y = x1
    return (g, x, y)

# n, p, w, d = map(int, raw_input().split())
n, p, w, d = map(int, stdin.readline().split())
# print(n, p, w, d)
g, x0, y0 = extgcd(w, d)
# print(type(g))
# print(type(x0))
# print(type(y0))
ans = True
if p % g != 0:
    ans = False
else:
    x0 *= p//g
    y0 *= p//g
    # print(type(x0))
    # print(type(y0))
    # x=x0+k*d/g
    # x0+k*d/g>=0
    # k>=-x0*g/d
    # x0+k*d/g<=n
    # k<=(n-x0)*g/d
    # y=y0-k*w/g
    # y0-k*w/g>=0, k<=y0*g/w
    # y0-k*w/g<=n, k>=(y0-n)*g/w
    klb = int(max(ceil(-x0*g/d), ceil((y0-n)*g/w)))
    kub = int(min(floor((n-x0)*g/d), floor(y0*g/w)))
    if d > w:
        kub = min(kub, int(floor(g*(n-x0-y0)/(d-w))))
    elif d < w:
        klb = max(klb, int(ceil(g*(n-x0-y0)/(d-w))))
    else:
        pass
    if klb > kub:
        ans = False
    else:
        k = klb
        z = -1
        while k <= kub and (z < 0 or z > n):
            x = x0+k*d//g
            y = y0-k*w//g
            z = n-x-y
            # print("%s %s %s" % (x, y, z))
            k += 1
        if z < 0 or z > n:
            ans = False
if ans:
    print("%s %s %s" % (x, y, z))
else:
    print("-1")

inp = input()
n, p,w,d = [int(e) for e in inp.split(" ")]

for i in range(100000):
    rest = p - i * d
    y = i
    x = rest // w
    if (rest >= 0 and rest % w  == 0 and x + y <= n ):
        print(rest // w, end=" ")
        print(y, end=" ")
        print(n - y - rest // w)
        quit()
print(-1)

n,p,w,d=map(int,input().split())
y=0
temp=p-y*d
minus1=1
while(temp>=0):
    if(temp%w==0):
        x=temp//w
        if(x+y<=n):
            print(x,y,n-x-y)
            minus1=0
            break
    y+=1
    temp-=d
    if(y>w):
        break
if(minus1):
    print(-1)

n,p,w,d=list(map(int,input().split()))
flag=0
x=-1
y=-1
z=-1
for i in range(w+1):
    if (p-(i*d))%w==0:
        y=i
        x=(p-(i*d))//w
        z=n-(x+y)
        flag=1
        break
if x<0 or y<0 or flag==0 or z<0:
    print(-1)
else:
    print(*[x,y,z])

from math import *
n,p,w,d=map(int,input().split())
if p%gcd(w,d)!=0 or w*n<p :
    print(-1)
elif p%w==0:
    print(p//w,0,n-p//w)

else:
    win=0
    draw=0
    loss=0
    while p%w!=0 and p>=0:
        draw+=1
        p=p-d
    if  p<0:
        print(-1)
    else:
        print(p//w,draw,n-p//w-draw)

def euclid(a, b):
	if b==0:
		return (1,0)
	x0, y0 = euclid(b, a%b)
	return (y0, x0 - divs(a,b)*y0)

def gcd(a,b):
	return gcd(b, a%b) if b != 0 else a

def divs(a, b):
	return a//b if a*b>0 else (a+(-a%b))//b

n, p, w, d = map(int, input().split())
g = gcd(w,d)
if p%g != 0:
	print(-1)
	exit(0)

x0, y0 = euclid(w,d)
x0 *= divs(p,g)
y0 *= divs(p,g)
num = (n-x0-y0)*g
den = d-w
kmin1 = (divs(num,den)+1 if divs(num,den) >= 0 else divs(num,den)) if num%den != 0 else divs(num,den)

num = -x0*g;
den = d;
kmin2 = (divs(num,den)+1 if divs(num,den) >= 0 else divs(num,den)) if num%den != 0 else divs(num,den)

num = y0*g;
den = w;

# prdivs('num= ', num)
# prdivs('den= ', den)
# prdivs('divs(num,den)= ', divs(num,den))

# prdivs('kmin1', kmin1)
# prdivs('kmin2', kmin2)

kmax = (divs(num,den) if divs(num,den) >= 0 else divs(num,den)-1) if num%den != 0 else divs(num,den)

# prdivs('kmax',kmax)

k = kmin1 if kmin1 > kmin2 else kmin2

# prdivs('k= ', k)
# prdivs('kmax= ', kmax)

if k>kmax:
	print(-1)
	exit(0)

x = x0 + divs((d*k),g)
y = y0 - divs((w*k),g)
z = n-x-y

print(str(x) + ' ' + str(y) + ' ' + str(z))

x = 0
y = 0

def exgcd( a, b):
    global x , y
    if (b == 0):
        x = 1
        y = 0
        return a;
    g = exgcd(b, a % b);
    t = x;
    x = y
    y = t - a // b * y;
    return g;

def Just_DOIT(w, d, p) :
    global x , y
    g = exgcd(w, d);
    if (p % g):
        return -1
    x *= p // g
    d //= g
    return (x % d + d) % d

n, p , w , d = map(int, input().split())
X = Just_DOIT(w, d, p)
Y = Just_DOIT(d, w, p)
if (X == -1):
    print(-1)
else:
    y1 = (p - X * w) // d
    x2 = (p - Y * d) // w;
    if (y1 >= 0 and X + y1 <= n) :
        print( X , y1 , n - X - y1 )
    else:
	    if (x2 >= 0 and x2 + Y <= n):
	        print( x2 , Y , n - x2 - Y )
	    else:
	        print(-1)

#

def gcd (a, b):
	if (a == 0):
		ans = [b, 0, 1]
		return ans
	d = gcd (b % a, a)
	ans = [d[0], d[2] - (b // a) * d[1], d[1]]
	return ans
n, p, w, d = map(int, input().split())
g = gcd(w, d)
if p % g[0] != 0:
    print (-1)
else:
    w = w // g[0]
    d = d // g[0]
    x = g[1] * (p // g[0])
    y = g[2] * (p // g[0])
    if y >= 0:
        c = y // w
        y -= c * w
        x += c * d
    else:
        c = (abs(y) + w - 1) // w
        y += c * w
        x -= c * d
    if x < 0:
        print(-1)
    elif x + y > n:
        print(-1)
    else:
        print(x, y, n - x - y)

def solve():
    n,p,w,d=map(int,input().split())
    x=p//w
    y=0
    while x>=0 and y<w:
        y=(p-x*w)/d
        if y==int(y):
            y=int(y)
            z=n-x-y
            if z<0:
                print(-1)
                return
            print(x,y,z)
            return
        x-=1
    print(-1)
    return

solve()

def egcd(a,b):
    if b==0:
        return a,1,0
    d,x,y = egcd(b,a%b)
    return d,y,x-a//b*y

def p5():
    n,p,w,d = map(int,input().split())
    g,a,b = egcd(w,d)
    if not p%g == 0:
        print(-1)
    else:
        w = w//g
        d = d//g
        p = p//g
        a = a*p
        b = b*p
        if a < 0:
            if b < 0:
                print(-1)
            else:
                k = b//w
                a = a + k*d
                b = b - k*w
                if a < 0 or a+b>n:
                    print(-1)
                else:
                    print(a,b,n-a-b)
        else:
            if b < 0:
                k = -b//w
                if not b%w==0:
                    k=k+1
                b = b + k*w
                a = a - k*d
                if a < 0 or a+b>n:
                    print(-1)
                else:
                    print(a,b,n-a-b)
            else:
                k = b//w
                a = a + k*d
                b = b - k*w
                if a < 0 or a+b>n:
                    print(-1)
                else:
                    print(a,b,n-a-b)

def main():
    p5()

if __name__ == '__main__':
    main()

n,p,w,d=list(map(int,input().split()))
flag=0
x=-1
y=-1
z=-1
for i in range(w):
    if (p-(i*d))%w==0:
        y=i
        x=(p-(i*d))//w
        z=n-(x+y)
        flag=1
        break
if x<0 or y<0 or flag==0 or z<0:
    print(-1)
else:
    print(*[x,y,z])

import math
c=0
n,p,w,d=map(int,input().split())
c=0
for i in range(w):
    nd=i
    if (p-nd*d)%w==0:
        nw=(p-nd*d)/w
        nl=n-nw-nd
        c=1
        break
if (w*n<p) or (c==0) or ((p<d) and (p>0)):
    print (-1)
else:
    print (int(nw)," ",int(nd)," ",int(nl))

import math

(n, p, w, d) = list(map(int, input().split()))

flag = False
a = w - d
b = -d
c = p - n * d

if p == 0:
    print(0, 0, n)

elif c % math.gcd(abs(a), abs(b)) != 0:
    print(-1)

else:
    X = math.gcd(abs(a), abs(b))
    if c >= 0:
        a //= X
        b //= X
        c //= X
    else:
        a //= -X
        b //= -X
        c //= -X

    for k in range(abs(a)):
        if (c - b * k) % a == 0:
            Y = k
            X = (c - b * Y) // a
            flag = True
            break

    if flag:
        if (0 <= X <= n) and (0 <= Y <= n) and (0 <= n - X - Y <= n):
            print(X, n - X - Y, Y)
        else:
            #kmax = min((n - X) // b, (n - Y) // a)
            #kmin = max((- Y) // a, (- X) // b)
            #print((n - X) // b)
            #print((n - Y) // a)
            #print(( - X) // b)
            #print(( - Y) // a)

            if a > 0:
                amax = Y // a
                amin = (Y - n) // a
            else:
                amin = Y // a
                amax = (Y - n) // a
            if b > 0:
                bmax = (n - X) // b
                bmin = -X // b
            else:
                bmin = (n - X) // b
                bmax = -X // b

            kmin = max(amin, bmin)
            kmax = min(amax, bmax)
            if kmin < kmax:
                for k in range(kmin - 2, kmax + 2):
                    xx = X + b * k
                    yy = Y - a * k
                    if (0 <= xx <= n) and (0 <= yy <= n) and (0 <= n - xx - yy <= n):
                        print(xx, n - xx - yy, yy)
                        flag = False
                        break
                if flag:
                    print(-1)

            else:
                print(-1)
    else:
        print(-1)

def nod(m, n):
    return m if n == 0 else nod(n, m % n)

n,c,a,b = map(int,input().split())

nodAB = nod(abs(a), abs(b))
if c % nodAB:
    print("-1")
else:
    a //= nodAB
    b //= nodAB
    c //= nodAB

    for k in range(abs(a)):
        if c >= b * k and (c - b * k ) % a == 0:
            y = k
            x = ( c - b * y ) // a
            if x + y > n:
                print(-1)
            else:
                print(x,y,n - x - y)
            break
    else:
        print("-1")

def ii():
    return int(input())
def mi():
    return map(int, input().split())
def li():
    return list(mi())

from math import gcd

def egcd(a, b):
    if a == 0:
        return (b, 0, 1)
    else:
        gcd, x, y = egcd(b % a, a)
        return (gcd, y - (b//a) * x, x)

def solve_Dioph(a,b,c):
    _, x, y = egcd(a, b)
    if c % g > 0:
        print(-1)
        exit()

    x *= c // g
    y *= c // g
    if (a < 0):
        x = -x;
    if (b < 0):
        y = -y;
    return x, y

n, p, w, d = mi()
a, b, c = w, d, p

g = gcd(a, b)
if p % g != 0:
    print(-1)
    exit()

x, y = solve_Dioph(a, b, p)

def get_x_y(k):
    assert((k * b) % g == 0)
    assert((k * a) % g == 0)
    ttx = x - (k * b) // g
    tty = y + (k * a) // g
    return ttx, tty

k_min = ((g * -y) + a - 1) // a
k_max = (g * x) // b
# print(k_min, k_max, get_x_y(k_min), get_x_y(k_max))
# k_max = min(k_max, ((n - (x+y)) * g) // (a-b))

if k_min > k_max:
    print(-1)
    exit()

# for wow in range(k_min - 100000, min(k_min + 100000, k_max+100000)):
x_, y_ = get_x_y(k_min)
# print(x_, y_, n - (x_ + y_))
if x_ >= 0 and y_ >= 0 and x_ + y_ <= n:
    print(x_, y_, n - (x_ + y_))
    exit()

print(-1)

def egcd(a,b):
    # return gcd, x,y or None
    if(a==0):
        return b,0,1

    gcd,x1,y1 = egcd(b%a,a)
    return gcd,y1-(b//a)*x1,x1

n,p,w,d = list(map(int,input().strip().split()))

g,x,y = egcd(w,d)
a,b=w,d

if(p%g!=0):
    print(-1)
else:
    #find smallest sum positive solutions
    # i.e final new x and y
    factor = p//g
    x*=factor
    y*=factor

    # find minimum +ve x
    from math import ceil
    k1=ceil(-x*g/b)
    k2=ceil(y*g/a)
    kmin = min(k1,k2)
    kmax = max(k1,k2)

    if(b>=a):
        k = kmin
    else:
        k = kmax
    z=n-x-y
    x = x + k*b//g
    y = y - k*a//g

    z=n-x-y
    if(z>=0 and x>=0 and y>=0 and x+y+z==n):
        print(x,y,z)
    else:
        print(-1)

import math
import random

n, p, w, d = map(int, input().split())

output = []

c = (p - d * n) / (w - d)
c = math.ceil(c)

for i in range(d):

	lower = (c - i) / d
	upper = (n - i) / d

	if lower - int(lower) == 0:

		lower = int(lower)
		upper = int(upper)

		a = lower

		condition = True

		while condition == True:

			b = i
			x = d * a + b

			if x >= 0:
				y = (p - x * w) / d

				if y >= 0:
					y = int(y)
					z = n - x - y

					if z >= 0:
						output = [x, y, z]
						condition = False

			a += 1
			if a > upper+1:
				condition = False

	if len(output) == 3:
		print(x, y, z)
		break

else:
	print(-1)

n,p,w,d=list(map(int,input().split()))
flag=0
for i in range(w+1):
    if (p-(i*d))%w==0:
        y=i
        x=(p-(i*d))//w
        z=n-(x+y)
        flag=1
        break
if flag==0 or z<0:
    print(-1)
else:
    print(*[x,y,z])

n,p,w,d=map(int,input().split())
y=0
while(y<w and p%w):
    y+=1
    p+=-d
x=p//w
if x>=0 and (x+y)<=n:
    print(x, y, n-(x+y))
else:
    print(-1)

n, p, w, d = map(int, input().split())
for y in range(w):
    x = (p - y * d) / w
    if x >= 0 and int(x) == x and n >= x + y:
        x = int(x)
        z = n - x - y
        print(x, y, z)
        break
else:
    print(-1)

x=0
y=0
g=0
def extendedEuclid(a,b):
    global x
    global y
    global g
    if (b == 0):
        x = 1
        y = 0
        g = a
        return
    extendedEuclid(b, a % b)
    CX = y
    CY = x - (a // b) * y
    x = CX
    y = CY

n,p,w,d=map(int,input().split())
extendedEuclid(w, d)
#print(" ",x," ",y)
if (p % g != 0):
    print("-1")
else:
    x = x * p // g
    y = y * p // g
    k = p // g
    #print(x,y)
    lower1 = int((-1) * x * g / d)
    if(lower1 > 0):
        lower1+=1
    lower2 = int(g * (x + y - n) /(w - d))
    if(lower2 > 0):
        lower2+=1
    upper = (g * abs(y)) // w
    if(y<0):
        upper=upper*(-1)
    if (upper < 0):
        upper-=1
    lower = max(lower1, lower2)
    #print("a ",lower1," ",lower2," ",upper)
    if(lower > upper):
        t=lower
        x = x + ((d * t) // g)
        y = y - ((w * t) // g)
        z = n - x - y
        if(x>=0 and y>=0 and z>=0):
            print(x,y,z)
        else:
            print("-1")
    else:
        t=lower
        if(upper>lower):
            t=lower+1
        x = x + (d * t) // g
        y = y - (w * t) // g
        z = n - x - y
        print(x," ",y," ",z)
        #print(y)
        #print(z)

''' CODED WITH LOVE BY SATYAM KUMAR '''

from sys import stdin, stdout
import heapq
import cProfile, math
from collections import Counter, defaultdict, deque
from bisect import bisect_left, bisect, bisect_right
import itertools
from copy import deepcopy
from fractions import Fraction
import sys, threading
import operator as op
from functools import reduce
import sys

sys.setrecursionlimit(10 ** 6)  # max depth of recursion
threading.stack_size(2 ** 27)  # new thread will get stack of such size
fac_warm_up = False
printHeap = str()
memory_constrained = False
P = 10 ** 9 + 7

class MergeFind:
    def __init__(self, n):
        self.parent = list(range(n))
        self.size = [1] * n
        self.num_sets = n
        self.lista = [[_] for _ in range(n)]

    def find(self, a):
        to_update = []
        while a != self.parent[a]:
            to_update.append(a)
            a = self.parent[a]
        for b in to_update:
            self.parent[b] = a
        return self.parent[a]

    def merge(self, a, b):
        a = self.find(a)
        b = self.find(b)
        if a == b:
            return
        if self.size[a] < self.size[b]:
            a, b = b, a
        self.num_sets -= 1
        self.parent[b] = a
        self.size[a] += self.size[b]
        self.lista[a] += self.lista[b]

    def set_size(self, a):
        return self.size[self.find(a)]

    def __len__(self):
        return self.num_sets

def display(string_to_print):
    stdout.write(str(string_to_print) + "\n")

def prime_factors(n):  # n**0.5 complex
    factors = dict()
    for i in range(2, math.ceil(math.sqrt(n)) + 1):
        while n % i == 0:
            if i in factors:
                factors[i] += 1
            else:
                factors[i] = 1
            n = n // i
    if n > 2:
        factors[n] = 1
    return (factors)

def all_factors(n):
    return set(reduce(list.__add__,
                      ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

def fibonacci_modP(n, MOD):
    if n < 2: return 1
    return (cached_fn(fibonacci_modP, (n + 1) // 2, MOD) * cached_fn(fibonacci_modP, n // 2, MOD) + cached_fn(
        fibonacci_modP, (n - 1) // 2, MOD) * cached_fn(fibonacci_modP, (n - 2) // 2, MOD)) % MOD

def factorial_modP_Wilson(n, p):
    if (p <= n):
        return 0
    res = (p - 1)
    for i in range(n + 1, p):
        res = (res * cached_fn(InverseEuler, i, p)) % p
    return res

def binary(n, digits=20):
    b = bin(n)[2:]
    b = '0' * (digits - len(b)) + b
    return b

def is_prime(n):
    """Returns True if n is prime."""
    if n < 4:
        return True
    if n % 2 == 0:
        return False
    if n % 3 == 0:
        return False
    i = 5
    w = 2
    while i * i <= n:
        if n % i == 0:
            return False
        i += w
        w = 6 - w
    return True

def generate_primes(n):
    prime = [True for i in range(n + 1)]
    p = 2
    while p * p <= n:
        if prime[p]:
            for i in range(p * 2, n + 1, p):
                prime[i] = False
        p += 1
    return prime

factorial_modP = []

def warm_up_fac(MOD):
    global factorial_modP, fac_warm_up
    if fac_warm_up: return
    factorial_modP = [1 for _ in range(fac_warm_up_size + 1)]
    for i in range(2, fac_warm_up_size):
        factorial_modP[i] = (factorial_modP[i - 1] * i) % MOD
    fac_warm_up = True

def InverseEuler(n, MOD):
    return pow(n, MOD - 2, MOD)

def nCr(n, r, MOD):
    global fac_warm_up, factorial_modP
    if not fac_warm_up:
        warm_up_fac(MOD)
        fac_warm_up = True
    return (factorial_modP[n] * (
            (pow(factorial_modP[r], MOD - 2, MOD) * pow(factorial_modP[n - r], MOD - 2, MOD)) % MOD)) % MOD

def get_int():
    return int(stdin.readline().strip())

def get_tuple():
    return map(int, stdin.readline().split())

def get_list():
    return list(map(int, stdin.readline().split()))

memory = dict()

def clear_cache():
    global memory
    memory = dict()

def cached_fn(fn, *args):
    global memory
    if args in memory:
        return memory[args]
    else:
        result = fn(*args)
        memory[args] = result
        return result

def ncr(n, r):
    return math.factorial(n) / (math.factorial(n - r) * math.factorial(r))

def binary_search(i, li):
    fn = lambda x: li[x] - x // i
    x = -1
    b = len(li)
    while b >= 1:
        while b + x < len(li) and fn(b + x) > 0:  # Change this condition 2 to whatever you like
            x += b
        b = b // 2
    return x

# -------------------------------------------------------------- MAIN PROGRAM

TestCases = False
optimise_for_recursion = True  # Can not be used clubbed with TestCases WHen using recursive functions, use Python 3

def main():
    n, p, w, d = get_tuple()
    gcd = math.gcd(w, d)
    if p%gcd ==0:
        p, w, d = p//gcd, w//gcd, d//gcd
        #print(p, w, d, gcd)
        for x in range(d):
            if (p - (x * w))%d == 0:
                y = (p - (x * w))//d
                #print(x, y)
                k = y//w
                y = y - k*w
                x = x + k*d
                if gcd*(x+y)<=n:
                    print(x * gcd, y * gcd, n - ((x + y) * gcd))
                    return
                break
    print(-1)

# --------------------------------------------------------------------- END=

if TestCases:
    for i in range(get_int()):
        main()
else:
    main() if not optimise_for_recursion else threading.Thread(target=main).start()

l=[int(i) for i in input().split()]
m=l[0]
p=l[1]
w=l[2]
d=l[3]
if(p>w*m):
        print(-1)
elif(p==w*m):
        print(m,0,0)
elif(p==0):
        print(0,0,m)
else:
        z=[]
        count1=p//w
        while(count1!=0):
            q=(p-(w*count1))%d
            if(q==0):
                cat=(p-(w*count1))//d
                z.append([count1,cat])
                break
            count1-=1
        if(len(z)==0):
            print(-1)
        else:
            flg=0
            for i in z:
                if(i[0]+i[1]<=m):
                    if(w*i[0]+d*i[1]==p):
                        print(i[0],i[1],m-(i[0]+i[1]))
                        break
                else:
                    flg+=1
            if(flg==len(z)):
                print(-1)

n, p, w, d = [int(x) for x in input().split()]

if p == 0:
  print("0 0 %s" % n)
  exit()

for i in range(w):
  pp = (p - i * d)
  pw = pp % w
  if pw == 0 and pp / w + i <= n:
    print("%s %s %s" % (pp//w, i, (p - i - pp//w)))
    exit()
print("-1")

def gcdExtended(a, b):
	global x,y
	if(a==0):
		x=0
		y=1
		return b
	gcd=gcdExtended(b%a,a)
	x1=x
	y1=y
	x=y1-(b//a)*x1
	y=x1
	return gcd

def min(a,b):
	if(a>b):
		return b
	return a

def max(a,b):
	if(a<b):
		return b
	return a

def produce(x,y,w2,d2,swap):
	lb=0
	ub=100000000000000000000000000
	lb=max(lb,(-x+d2-1)//d2)
	ub=min(ub,(n-x)//d2)
	ub=min(ub,(n-x)//d2)
	lb=max(lb,(y-n+w2-1)//w2)
	if(d2-w2>0):
		ub=min(ub, (n-x-y)//(d2-w2))
		lb=max(lb, (-x-y+d2-w2-1)//(d2-w2))
	elif(w2-d2>0):
		ub=min(ub, (x+y)//(w2-d2))
		lb=max(lb, (x+y-n+w2-d2-1)//(w2-d2))
	if(lb<=ub):
		v1=x+lb*d2
		v2= y-lb*w2
		v3=n-v1-v2
		if(v1>=0 and v2>=0 and v3>=0):
			if(not swap):
				print(v1,v2,v3)
				return True
			else:
				print(v2,v1,v3)
				return True

	return False

n,p,w,d=map(int,input().split())
x=1
y=1
g=gcdExtended(w,d)
if(not p%g==0):
	print(-1)
else:
	swap=False
	p=p//g
	w2=w
	d2=d
	x=x*p
	y=y*p
	if(not produce(x,y,w2,d2,False)):
		if(not produce(y,x,d2,w2,True)):
			print(-1)

n,p,w,d=map(int,input().split())
for y in range(w+1):
	temp=p-(y*d)
	if temp%p!=0:
		continue
	x=p-(d*y)
	if x<0:
		continue
	x=x//w
	z=n-x-y
	if z<0:
		continue
	else:
		print(x,y,z)
		exit()
print(-1)

import math

def gcd(a,b):
    if 0==b:
        return a
    else:
        return gcd(b,a%b)

def lcm(a,b):
    return a*b/gcd(a,b)

def exgcd(a,b,X,Y):
    if 0==b:
        X[0]=1
        Y[0]=0
        return a
    g=exgcd(b,a%b,Y,X)
    Y[0]-=a//b*X[0]
    return g

def main():
    n,p,w,d=map(int,input().split());
    if 0==p:
        print('0 0 %d'%n);
        return
    g=gcd(w,d)
    if p%g!=0:
        print('-1')
        return
    X=[0]
    Y=[0]
    exgcd(w,d,X,Y)
    x=X[0]*p/g;
    y=Y[0]*p/g;

    L=max((p-d*n)/(w-d),0)
    R=p/w;

    k1=lcm(w,d)/w
    k2=lcm(w,d)/d

    mint=math.ceil((L-x)/k1)
    maxt=math.floor((R-x)/k1)

    if mint<=maxt:
        ansx=x+k1*mint
        ansy=y-k2*mint
        print('%d %d %d'%(ansx,ansy,n-ansx-ansy))
    else:
        print('-1')
main()

import sys
from fractions import gcd
n, p, w, d = [int(item) for item in input().split()]
div = gcd(w, d)
if p % div != 0:
    print(-1)
else:
    p //= div
    w //= div
    d //= div
    ans = False
    reverse = False
    if w < d:
        w, d = d, w
        reverse = True
    for x in range(p // w, max(-1, p // w - 10**5), -1):
        if (p - x * w) % d != 0:
            continue
        y = (p - x * w) // d
        if y < 0 or x + y > n:
            continue
        ans = True
        break
    if ans:
        if reverse:
            print(x, y, n - x - y)
        else:
            print(y, x, n - x - y)
    else:
        print(-1)

n, p, w, d = [int(i) for i in input().split(' ')]

wins = p // w
while wins >= 0:
    points_to_cover = p - w * wins
    if points_to_cover % d == 0:
        draws = points_to_cover // d
        if wins + draws > n:
            print(-1)
            exit(0)
        print(f'{wins} {draws} {n - wins - draws}')
        exit(0)
    wins -= 1
# if n * w < p:
#     print(-1)
# elif p % w == 0:
#     wins = p // w
#     print(f'{wins} 0 {n - wins}')
# else:
#     x = p // w
#     actual_points = x * p
#     while actual_points >= 0:
#         y =
#         if y % d == 0:
#             print(
#     if y % d == 0:
#         print
#     if index == -1:
#         print(index)
#     else:
#         print(f'{index} {n - index} {0}')

from math import ceil
def gcd(a, b):
    if a == 0:
        return b, 0, 1

    gc,x1,y1 = gcd(b%a, a)

    x = y1-(b//a) * x1
    y = x1
    return gc,x,y

n,p,w,d = map(int, input().split())

wd_gcd, b1, b2 = gcd(w,d)

if (p % wd_gcd != 0):
    print("-1")
else:
    fac = p//wd_gcd
    b1 *= fac
    b2 *= fac

    low_lim = -b1/(d/wd_gcd)
    hl = b2/(w//wd_gcd)
    low_lim2=(b1+b2-n)/((w-d)//wd_gcd)

    ll = max(low_lim, low_lim2)

    if (ll <= hl and ll >= 0):
        k = ceil(ll)

        if (k <= hl):
            print(b1+k*(d//wd_gcd), b2 - k * (w//wd_gcd), n - b1 - b2 + ((w-d)//wd_gcd)*k)
        else:
            print("-1")
    else:
        print("-1")

x=0
y=0
g=0
def extendedEuclid(a,b):
    global x
    global y
    global g
    if (b == 0):
        x = 1
        y = 0
        g = a
        return
    extendedEuclid(b, a % b)
    CX = y
    CY = x - (a // b) * y
    x = CX
    y = CY

n,p,w,d=map(int,input().split())
extendedEuclid(w, d)
#print(" ",x," ",y)
if (p % g != 0):
    print("-1")
else:
    x = x * p // g
    y = y * p // g
    k = p // g
    #print(x,y)
    lower1 = int((-1) * x * g / d)
    if(lower1 > 0):
        lower1+=1
    lower2 = int(g * (x + y - n) /(w - d))
    if(lower2 > 0):
        lower2+=1
    upper = (g * abs(y)) // w
    if(y<0):
        upper=upper*(-1)
    if (upper < 0):
        upper-=1
    lower = max(lower1, lower2)
    #print("a ",lower1," ",lower2," ",upper)
    if(lower > upper+1):
        t=lower
        x = x + ((d * t) // g)
        y = y - ((w * t) // g)
        z = n - x - y
        if(x>=0 and y>=0 and z>=0):
            print(x,y,z)
        else:
            print("-1")
    else:
        t=lower
        if(upper>lower):
            t=lower+1
        x = x + (d * t) // g
        y = y - (w * t) // g
        z = n - x - y
        print(x," ",y," ",z)
        #print(y)
        #print(z)

n,p,w,d=map(int,input().split())
if n*w<p:
    print(-1)
elif (p%w==0 and p//w<=n) or (p%d==0 and p//d<=n):
    if p%w==0:
        print(p//w,0,n-p//w)
    else:
        print(0,p//d,n-p//d)
else:
    total=0
    i=0
    total=int(p/w)*w
    i=int(p/w)
    dif=p-total
    if dif==0:
        print(i,0,n-i)
    elif dif%d==0:
        print(i,dif//d,n-i-dif//d)
    else:
        while dif%d!=0:
            dif+=w
            i-=1
        print(i,dif//d,n-i-dif//d)

# Brute force 2: Keep subtracting it by the larger number

# HCF
def hcf(a,b):
	if a<b:
		return hcf(b,a)
	while b!=0:
		a,b=b,a%b
	return a

inpu = (input()).split(" ")
inp = [int(x) for x in inpu]
n,p,w,d = inp[0], inp[1], inp[2], inp[3]

flag = 0

if p == 0:
	print("0 0 "+str(n))
else:
	f = hcf(w,d)
	if f != 1:
		rem = p%f
		if rem !=0:
			print(-1)
			flag = 1
		else:
			p = p//f
			d = d//f
			w = w//f

	if flag == 0:
		p = float(p)
		w = float(w)
		pp = p/w
		dd = d/w
		l1 = int(p//d)
		#print(pp,dd,l1)
		for i in range(l1+1):
			#print(pp,dd,l1)
			a = pp-dd*i
			#print(a)
			if a == int(a) and (int(a)+i<=n):
				print(str(int(a))+" "+str(i)+" "+str(int(n-a-i)))
				break

		else:
			print(-1)

def egcd(a, b):
	if a == 0:
		return (b, 0, 1)
	else:
		gcd, x, y = egcd(b % a, a)
		return (gcd, y - (b//a) * x, x)

n,p,w,d = input().split(' ')
n = int(n)
p = int(p)
w = int(w)
d = int(d)

gcd, nx, ny = egcd(w,d)

if (p % gcd or p > n * w):
    print(-1)
else:
    nx *= p // gcd
    ny *= p // gcd
    w //= gcd
    d //= gcd
    new_Y = ny % w
    nx += d * ((ny - new_Y) // w)
    if (nx + new_Y > n):
        print(-1)
    else:
        print(nx,new_Y,n-nx-new_Y)

n,p,w,d = map(int, input().split())

res = (-1, -1)
for i in range(d+1):
  x = i*w
  remain = p if x == 0 else p % (i*w )
  if remain % d == 0:
    cd = remain // d
    cw = (p - cd*d) // w
    if cw + cd <= n:
      res = (cw, cd)

if res != (-1, -1):
  cw, cd = res
  print(cw, cd, n-cw-cd)
else:
  print(-1)

n, p, w, d = list(map(int, input().split()))

rem = p % w

# print(rem)
if rem == 0:
    if (n - p/w) >= 0:
        print(int(p/w), 0, int(n - p/w))
    else:
        print(-1)
    exit(0)

if rem % d != 0:
    print(-1)
else:
    if n - p/w - rem/d >= 0:
        print(int(p/w), int(rem/d), int(n - p/w - rem/d))
    else:
        print(-1)

x=int(0)
y=int(0)

def exgcd(a,b):
    global x,y
    if b==0:
        x=1
        y=0
        return a
    d=exgcd(b,a%b)
    tmp=x
    x=y
    y=tmp-a//b*y
    return d

n,p,w,d=map(int,input().split())

if p==0:
    print('0 0 ',end='')
    print(n)
else:
    tmp=exgcd(w,d)
    if p%tmp!=0:
        print('-1')
    else:
        d1=d//tmp
        d2=w//tmp
        x*=(p//tmp)
        x=(x%d1+d1)%d1
        y=(p-w*x)//d
        if y<0:
            print('-1')
        else:
            k=(n-x-y)//(d1-d2)
            if k>0 and (n-x-y)%(d1-d2)!=0:
                k+=1
            x=x+k*d1
            y=y-k*d2
            if y<0:
                print(-1)
            else:
                print(x,y,n-x-y,end=' ')

n,p,d,w = map(int,input().split())
res = False
for draws in range(w):
    remain = p - draws*d
    if remain>=0 and remain%w==0 and draws+remain//w<=n:
        print(remain//w, draws,n-(remain//w)-draws)
        res = True
if not res:
    print(-1)

from __future__ import division, print_function
def main():
    n,p,w,d=map(int,input().split())
    wins=0
    def gcd(a,b):
        while b:
            a,b=b,a%b
        return a
    lcm=(w*d)//gcd(w,d)
    x=lcm//w
    while (wins*w)<=lcm and wins<n and (p-wins*w)%d!=0:
        wins+=1

    if (p-wins*w)%d==0:
        low=0
        high=(n-wins)//x

        while low<=high:
            mid=(high+low)//2
            a=mid*x+wins
            if p<a*w:
                high=mid-1
                continue
            draws=(p-a*w)//d
            if a+draws>n:
                low=mid+1
            else :
                break

        draws=(p-a*w)//d
        if a+draws<=n and draws>0:
            print(a,draws,n-a-draws)
        else :
            print(-1)
    else :
        print(-1)

######## Python 2 and 3 footer by Pajenegod and c1729

# Note because cf runs old PyPy3 version which doesn't have the sped up
# unicode strings, PyPy3 strings will many times be slower than pypy2.
# There is a way to get around this by using binary strings in PyPy3
# but its syntax is different which makes it kind of a mess to use.

# So on cf, use PyPy2 for best string performance.

py2 = round(0.5)
if py2:
    from future_builtins import ascii, filter, hex, map, oct, zip
    range = xrange

import os, sys
from io import IOBase, BytesIO

BUFSIZE = 8192
class FastIO(BytesIO):
    newlines = 0

    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0,2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        while self._fill(): pass
        return super(FastIO,self).read()

    def readline(self):
        while self.newlines == 0:
            s = self._fill(); self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.getvalue())
            self.truncate(0), self.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            self.write = lambda s:self.buffer.write(s.encode('ascii'))
            self.read = lambda:self.buffer.read().decode('ascii')
            self.readline = lambda:self.buffer.readline().decode('ascii')

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip('\r\n')

# Cout implemented in Python
import sys
class ostream:
    def __lshift__(self,a):
        sys.stdout.write(str(a))
        return self
cout = ostream()
endl = '\n'

# Read all remaining integers in stdin, type is given by optional argument, this is fast
def readnumbers(zero = 0):
    conv = ord if py2 else lambda x:x
    A = []; numb = zero; sign = 1; i = 0; s = sys.stdin.buffer.read()
    try:
        while True:
            if s[i] >= b'0' [0]:
                numb = 10 * numb + conv(s[i]) - 48
            elif s[i] == b'-' [0]: sign = -1
            elif s[i] != b'\r' [0]:
                A.append(sign*numb)
                numb = zero; sign = 1
            i += 1
    except:pass
    if s and s[-1] >= b'0' [0]:
        A.append(sign*numb)
    return A

if __name__== "__main__":
  main()

def gcd(a,b):
	if b==0:
		return a
	return gcd(b,a%b)
def isPossible(a, b, c):
	return (c % gcd(a, b) == 0)

n,p,w,d=map(int,input().split())
if isPossible(w,d,p):

	x=p//w
	rep=p-(x*w)
	y=rep//d
	baaki=rep-(y*d)
	if baaki!=0:
		print(-1)
		exit()
	z=n-(x+y)
	if z<0:
		print(-1)
		exit()
	print(x,y,z)
else:
	print(-1)

from math import ceil

n,p,w,d = map(int, input().split())
e = x = n
s = 0
y = None
for i in range(64):
    a = x * w
    y = ceil((p - a) / d)
    if y < 0:
        e = x
        x = (s + x) // 2
        continue
    b = y * d
    ss = a + b
    if ss == p and x+y <= n:
        break
    if (a < p) or x + y > n:
        s = x
        x = (e + x) // 2
    else:
        e = x
        x = (s + x) // 2
else:
    dir_ = 1 if p - ss > 0 else -1
    for i in range(100000):
        x += dir_
        a = x * w
        y = (p - a) // d
        b = y * d
        ss = a + b
        if ss == p and x+y <= n:
            break
    else:
        print(-1)
        exit()
print(x, y, n - x - y)

n, p, w, d = list(map(int, input().split()))

s = 0

if (n * w < p):
    print(-1)
elif (p % w == 0):
    print(' '.join(map(str, [p // w, 0, n - p // w])))
else:
    max_w = p // w
    for i in range(max_w + 1):
        y_z = p - i * w
        if (y_z % d == 0) and (y_z // d > 0) and (y_z // d <= n - 1):
            print(' '.join(map(str, [i, y_z// d, n - i - y_z// d])))
            s = 1
            break
    if (s == 0):
        print(-1)

x=0
y=0
g=0
def extendedEuclid(a,b):
    global x
    global y
    global g
    if (b == 0):
        x = 1
        y = 0
        g = a
        return
    extendedEuclid(b, a % b)
    CX = y
    CY = x - (a // b) * y
    x = CX
    y = CY

n,p,w,d=map(int,input().split())
extendedEuclid(w, d)
#print(" ",x," ",y)
if (p % g != 0):
    print("-1")
else:
    x = x * p // g
    y = y * p // g
    k = p // g
    #print(x,y)
    lower1 = int((-1) * x * g / d)
    if(lower1 > 0):
        lower1+=1
    lower2 = int(g * (x + y - n) /(w - d))
    if(lower2 > 0):
        lower2+=1
    upper = (g * abs(y)) // w
    if(y<0):
        upper=upper*(-1)
    if (upper < 0):
        upper-=1
    lower = max(lower1, lower2)
    #print("a ",lower1," ",lower2," ",upper)
    if(lower > upper+1):
        print("-1")
    else:
        t=lower
        if(upper>lower):
            t=lower+1
        x = x + (d * t) // g
        y = y - (w * t) // g
        z = n - x - y
        print(x," ",y," ",z)
        #print(y)
        #print(z)

list1=[int(x) for x in input().split(' ')]
c=int(list1[1]/list1[3])
n=list1[1]
while c != 0:
    n-=list1[3]
    c=n % list1[2]
a=int(n/list1[2])
b=int((list1[1]-n)/list1[3])
if a+b <= list1[0]:
    print(a,b,list1[0]-a-b,sep=' ')
else:
    print(-1)

n,p,w,d=map(int, input().split(' '))
x=p//w
for y in range(w):
    if((y*d - p%w)%w==0):
        x-=((y*d-p%w)//w)
        break
z=n-x-y
if(x+y+z==n and x*w+y*d==p):
    print("%d %d %d"%(x,y,z))
else:
    print("-1")

n, p, w, d = map(int, input().split())

x = y = 0

def gcd_ext(a,b):
  global x,y
  if a == 0:
    x, y = 0, 1
    return b
  d = gcd_ext(b % a, a)
  x, y = y - (b // a) * x, x
  return d

t = gcd_ext(w, d)

if p % t != 0:
  print(-1)
else:
  x *= (p // t)
  y *= (p // t)
  sx, sy = x, y
  while x + y > n and y >= 0:
    x += d // t
    y -= w // t
  if x + y <= n and x >= 0 and y >= 0:
    print(x, y, n-(x+y))
  else:
    x,y = sx,sy
    while x + y > n and x >= 0:
      x -= d // t
      y += w // t
    if x + y <= n and x >= 0 and y >= 0:
      print(x, y, n-(x+y))
    else:
      print(-1)

l1 = [int(x) for x in input().split()]
n = l1[0]
p = l1[1]
w = l1[2]
d = l1[3]
rem = p%w
if rem%d==0:
    y = rem//d
    x = (p-(d*y))//w
    z = n-x-y
    print(x,y,z)
else:
    print(-1)

import math
n,p,w,d = [int(i) for i in input().split()]
g = math.gcd(w, d)
if p % g != 0:
    print(-1)
    exit()

ww = w // g
dd = d // g
pp = p // g

aa, bb = w, d
k = []

while bb != 0:
    kk = aa // bb
    k.append(kk)
    temp = aa % bb
    aa = bb
    bb = temp

# print(k)

tups = [[1,0], [0, 1]]
for i in range(len(k)):
    nex = [0, 0]
    nex[0] = tups[-2][0] - k[i] * tups[-1][0]
    nex[1] = tups[-2][1] - k[i] * tups[-1][1]
    tups.append(nex)

# print(tups)

x0 = tups[-2][0] * pp
y0 = tups[-2][1] * pp

bigt = y0 // ww

y1 = y0 - bigt * ww
x1 = x0 + bigt * dd

y2 = y1 * g
x2 = x1 * g

if x2 + y2 > n or x2 < 0:
    oldt = bigt
    for i in range(-100000, 100000):
        bigt = oldt + i
        y1 = y0 - bigt * ww
        x1 = x0 + bigt * dd

        y2 = y1 * g
        x2 = x1 * g

        if x2 >= 0 and y2 >= 0 and x2 + y2 <= n:
            print(x2, y2, n - x2 - y2)
            exit()

    print(-1)
else:
    if x2 * w + y2 * d != p:
        1//0
    if y2 < 0:
        while True:
            pass

    print(x2, y2, n - x2 - y2)

def egcd(a, b):
  x,y, u,v = 0,1, 1,0
  while a != 0:
    q, r = b//a, b%a
    m, n = x-u*q, y-v*q
    b,a, x,y, u,v = a,r, u,v, m,n
  gcd = b
  return int(gcd), int(x), int(y)

n, D, a, b = map(int, input().split())
d, x, y = egcd(a, b)

if (D%d != 0):
  print ("-1")
  exit()

x *= D//d;
y *= D//d;

if (y < 0):
  up = ( (1 - y) + (a//d - 1) ) // (a//d);
  x -= (b//d) * up;
  y += (a//d) * up;

if (y > a//d):
  drop = (y-1) // (a//d);
  x += b//d * drop;
  y -= a//d * drop;

if (x < 0):
  print ("-1")
  exit()

rem = n - (x+y)
if (rem < 0):
    print ("-1")
else:
    print (x, y, rem)

def egcd(a, b):
    if a == 0:
        return (b, 0, 1)
    else:
        g, x, y = egcd(b % a, a)
        return (g, y - (b // a) * x, x)

from math import gcd
def isPossible(a, b, c):
    return (c % gcd(a, b) == 0)

n, c, a, b = [int(x) for x in input().split()]

if isPossible(a, b, c):
    X = egcd(a, b)
    g = X[0]
    x = X[1] * c // g
    y = X[2] * c // g
    k = -1
    # print(x, y)
    l = max((x * g * -1) / b, ((n - x - y) * g) / (b - a))
    h = (y * g) / a
    # print("l, h: ", l, h)
    if l > h: print(-1)
    else:
        for i in range(int(l), int(h) + 1):
            if i >= l and i <= h:
                k = i
                break
        if k == -1: print(k)
        else:
            # print(k)
            x = x + (k * (b // g))
            y = y - (k * (a // g))
            z = n - x - y
            print(x, y, z)
else: print(-1)

def egcd(a, b):
    """return (g, x, y) such that a*x + b*y = g = gcd(a, b)"""
    if a == 0:
        return (b, 0, 1)
    else:
        b_div_a, b_mod_a = divmod(b, a)
        g, x, y = egcd(b_mod_a, a)
        return (g, y - b_div_a * x, x)

X = 1; Y = 1; GCD = 1;
n, p, w, d = map(int, input().split())
__ = egcd(w, d)
X = __[1]
Y = __[2]
GCD = __[0]

if p % GCD != 0:
    print(-1)
else:
    X *= p // GCD;
    Y *= p // GCD;
    LCM = w * d // GCD;
    a = LCM // w;
    b = LCM // d;
    if X > Y:
        alp = (-Y + b - 1) // b;
        x = X - alp * a;
        y = alp * b + Y;
        z = n - x - y;
        if x < 0 or y < 0 or z < 0:
            print(-11)
        else:
            print(x, end = " ")
            print(y, end = " ")
            print(z)
    else:
        alp = Y // b;
        x = alp * a + X;
        y = Y - alp * b;
        z = n - x - y;
        if x < 0 or y < 0 or z < 0:
            print(-12)
        else:
            print(x, end = " ")
            print(y, end = " ")
            print(z)

from __future__ import division, print_function
def main():
    n,p,w,d=map(int,input().split())
    wins=0
    def gcd(a,b):
        while b:
            a,b=b,a%b
        return a
    lcm=(w*d)//gcd(w,d)
    x=lcm//w
    while (wins*w)<=lcm and wins<n and (p-wins*w)%d!=0:
        wins+=1

    if (p-wins*w)%d==0:
        low=0
        high=(n-wins)//x

        while low<=high:
            mid=(high+low)//2
            a=mid*x+wins
            if p<a*w:
                high=mid-1
                continue
            draws=(p-a*w)//d
            if a+draws>n:
                low=mid+1
            else :
                break

        draws=(p-a*w)//d
        if a+draws<=n:
            print(a,draws,n-a-draws)
        else :
            print(-1)
    else :
        print(-1)

######## Python 2 and 3 footer by Pajenegod and c1729

# Note because cf runs old PyPy3 version which doesn't have the sped up
# unicode strings, PyPy3 strings will many times be slower than pypy2.
# There is a way to get around this by using binary strings in PyPy3
# but its syntax is different which makes it kind of a mess to use.

# So on cf, use PyPy2 for best string performance.

py2 = round(0.5)
if py2:
    from future_builtins import ascii, filter, hex, map, oct, zip
    range = xrange

import os, sys
from io import IOBase, BytesIO

BUFSIZE = 8192
class FastIO(BytesIO):
    newlines = 0

    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0,2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        while self._fill(): pass
        return super(FastIO,self).read()

    def readline(self):
        while self.newlines == 0:
            s = self._fill(); self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.getvalue())
            self.truncate(0), self.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            self.write = lambda s:self.buffer.write(s.encode('ascii'))
            self.read = lambda:self.buffer.read().decode('ascii')
            self.readline = lambda:self.buffer.readline().decode('ascii')

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip('\r\n')

# Cout implemented in Python
import sys
class ostream:
    def __lshift__(self,a):
        sys.stdout.write(str(a))
        return self
cout = ostream()
endl = '\n'

# Read all remaining integers in stdin, type is given by optional argument, this is fast
def readnumbers(zero = 0):
    conv = ord if py2 else lambda x:x
    A = []; numb = zero; sign = 1; i = 0; s = sys.stdin.buffer.read()
    try:
        while True:
            if s[i] >= b'0' [0]:
                numb = 10 * numb + conv(s[i]) - 48
            elif s[i] == b'-' [0]: sign = -1
            elif s[i] != b'\r' [0]:
                A.append(sign*numb)
                numb = zero; sign = 1
            i += 1
    except:pass
    if s and s[-1] >= b'0' [0]:
        A.append(sign*numb)
    return A

if __name__== "__main__":
  main()

import math
a=list(map(int,input().split(" ")))
b=math.gcd(a[-2],a[-1])
if a[1]%b!=0:
    print(-1)
else:
    c=int(a[1]/a[2])
    for i in range(c,c-10000,-1):
        if (a[1]-a[2]*i)%a[3]==0:
            d=int(a[1]-a[2]*i)/a[3]
            e=i
            if e+d>a[0]:
                print(-1)
                break
            else:
                f=a[0]-e-d
                print("%d %d %d" %(e,d,f))
                break

import math

def input_int():
    return list(map(int, input().split()))

def solve():
    [n, p, w, d] = input_int()
    if p == 0:
        print(0, 0, n)
    else:
        if w != 1:
            x = (p - n * d) // (w - d)
            y = n - x
        else:
            y = (p - n) // (d - 1)
            x = n - y
        if x < 0 or y < 0:
            print(-1)
        else:
            print(x, y, 0)
    return

solve()

data = input()
data = data.split()
n = int(data[0])
p = int(data[1])
w = int(data[2])
d = int(data[3])

p_int_d = int(p/d)
p_rem_d = p%d
w_int_d = int(w/d)
w_rem_d = w%d

answer = False

if( (p/w) <= n):
    if( (p - n*d) <= 0 ) :
        low_lim = 0
    else :
        low_lim = int( (p - (n-1)*d)/w )
    top_lim = int(p/w)

    i = top_lim
    while (i >= low_lim) :
        if( (i + int((p-i*w)/d)) <= n ) :
            if( ((p-w*i)%d) == 0 ):
                answer = True
                x = i
                y =int((p-i*w)/d)
                z = n - x - y
                break
        else :
            break
        i = i + 1

    if(answer == True) :
        print(x, end=' ')
        print(y, end=' ')
        print(z)
else :
    print(-1)

n,p,w,d=[int(i) for i in input().split(" ")]

def exgcd(a,b):
    if b==0:
        return (1,0)
    tx,ty=exgcd(b,a%b)
    return (ty,tx-a//b*ty)

def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)

x,y=exgcd(w,d)
g=gcd(w,d)
if p%g!=0:
    print("-1")
    exit()
p/=g
x*=p
y*=p
if x<0 and y<0:
    print("-1")
    exit()
if y<0:
    z=x
    x=y
    y=z
    z=w
    w=d
    d=z
tmp=(-x+d-1)//d
x+=d*tmp
y-=w*tmp
if y<0:
    print("-1")
    exit()
x+=d*(y//w)
y%=w
if x+y>n:
    print("-1")
    exit()
print(int(x),int(y),int(n-x-y))

n,p,w,d=map(int, input().split(' '))
x=p//w
for y in range(0,w):
    if((y*d - p%w)%w==0):
        x-=((y*d-p%w)//w)
        break
z=n-x-y
if(x+y<=n and y<w and x>=0):
    print("%d %d %d"%(x,y,z))
else:
    print("-1")

import sys
import math

input = sys.stdin.readline

big_number = 10000000

n, p, w, d = map(int, input().split())

gcd_w_d = math.gcd(w, d)

if (p % gcd_w_d != 0) or (p > w*n + d*n) or (p<w):
    print(-1)
else:
    x0 = -1
    for i in range(0, int(p/w)):
        cur_x = p - w * i
        if cur_x % d == 0:
            x0 = i
            break

    if x0 == -1:
        print(-1)
    else:
        x = -1
        y = -1
        for i in range(0, n):
            x = x0 + i * (int(d / gcd_w_d))
            if p - w*x < 0:
                x = -1
                break
            y = int((p - w*x) / d)
            if x + y <= n:
                break

        if x == -1:
            print(-1)
        else:
            print(x, y, n - x - y)

# elements_array = list(map(int, input().split()))

# elements_array.sort()

# answer_elements_list = [(big_number, -1)]*(elements_array[-1] + 1)

# for element in elements_array:
#     cur_element = element
#     i = 0
#     while cur_element >= 0:
#         if answer_elements_list[cur_element][0] < big_number:
#             if answer_elements_list[cur_element][1] < k:
#                 new_tuple = (answer_elements_list[cur_element][0] + i, answer_elements_list[cur_element][1] + 1)
#                 answer_elements_list[cur_element] = new_tuple
#             else:
#                 break
#         else:
#             answer_elements_list[cur_element] = (i, 1)
#         if cur_element == 0:
#             break
#         cur_element = int(cur_element / 2)
#         i += 1

# best_result = big_number
# for value in answer_elements_list:
#     if value[1] < k:
#         continue
#     cur_operations = value[0]
#     best_result = min(best_result, cur_operations)

# print(best_result)

import math
n,p,w,d = [int(i) for i in input().split()]
g = math.gcd(w, d)
if p % g != 0:
    print(-1)
    exit()

ww = w // g
dd = d // g
pp = p // g

aa, bb = w, d
k = []

while bb != 0:
    kk = aa // bb
    k.append(kk)
    temp = aa % bb
    aa = bb
    bb = temp

# print(k)

tups = [[1,0], [0, 1]]
for i in range(len(k)):
    nex = [0, 0]
    nex[0] = tups[-2][0] - k[i] * tups[-1][0]
    nex[1] = tups[-2][1] - k[i] * tups[-1][1]
    tups.append(nex)

# print(tups)

x0 = tups[-2][0] * pp
y0 = tups[-2][1] * pp

bigt = y0 // ww

y1 = y0 - bigt * ww
x1 = x0 + bigt * dd

y2 = y1 * g
x2 = x1 * g

if x2 + y2 > n or x2 < 0:
    print(-1)
else:
    print(x2, y2, n - x2 - y2)

def gcdExtended(a, b):
    if a == 0 :
        return b,0,1
    gcd,x1,y1 = gcdExtended(b%a, a)
    x = y1 - (b//a) * x1
    y = x1
    return gcd,x,y

n,p,w,d=map(int,input().split())

gc,x0,y0=gcdExtended(w,d)
if p%gc!=0:
    print(-1)
    exit(0)

u=p//gc
x1=x0*u
y1=y0*u
from math import ceil

r1=-x1*gc//d
r2=y1*gc//w

u=gc*(n-x1-y1)//(d-w)
print(x1+(d*u//gc),y1-(w*u//gc),n-((x1+(d*u//gc))+(y1-(w*u//gc))))

from fractions import gcd

def modinv(x, n):
    s, old_s = 0, 1
    t, old_t = 1, 0
    r, old_r = n, x
    while r != 0:
        quotient = old_r // r
        old_r, r = r, old_r - quotient * r
        old_s, s = s, old_s - quotient * s
        old_t, t = t, old_t - quotient * t

    if old_r != 1: return -1
    return old_s % n

n, p, w, d = map(int, raw_input().strip().split())

g = gcd(w, d)
if p % g != 0:
    print -1
    exit()

r = modinv(d, w - d)
r *= p

if r < 0:
    print -1
    exit()

q = (p - w * r + w * (w - d) - 1) / (w * (w - d))
N = q * (w - d) + r

if N > n:
    print -1
    exit()

x = (p - N * d) / (w - d)
if (x < 0):
    print -1
    exit()

y = N - x
z = n - N

try:
    assert (w * x + d * y == p and x + y + z == N and x >= 0 and y >= 0 and z >= 0)
except:
    print -1
    exit()

print x, y, z

import math

def input_int():
    return list(map(int, input().split()))

def solve():
    [n, p, w, d] = input_int()
    lo = 0
    hi = n
    wins = hi
    while wins != lo:
        wins = (lo + hi) // 2
        win_points = wins * w
        points_left = p - win_points
        if points_left < 0:
            hi = wins
            continue
        draws = min(points_left // d, n - wins)
        leftover_points = points_left - draws * d
        losses = n - wins - draws
        if leftover_points == 0:
            print(wins, draws, losses)
            return
        if leftover_points > 0:
            lo = wins
            continue
    print(-1)
    return

solve()

x=0
y=0
g=0
def extendedEuclid(a,b):
    global x
    global y
    global g
    if (b == 0):
        x = 1
        y = 0
        g = a
        return
    extendedEuclid(b, a % b)
    CX = y
    CY = x - (a // b) * y
    x = CX
    y = CY

n,p,w,d=map(int,input().split())
extendedEuclid(w, d)
#print(" ",x," ",y)
if (p % g != 0):
    print("-1")
else:
    x = x * p // g
    y = y * p // g
    k = p // g
    #print(x,y)
    lower1 = int((-1) * x * g / d)
    if(lower1 > 0):
        lower1+=1
    lower2 = int(g * (x + y - n) /(w - d))
    if(lower2 > 0):
        lower2+=1
    upper = (g * abs(y)) // w
    if(y<0):
        upper=upper*(-1)
    if (upper < 0):
        upper-=1
    lower = max(lower1, lower2)
    #print("a ",lower1," ",lower2," ",upper)
    if(lower > upper):
        print("-1")
    else:
        t=lower
        if(upper>lower):
            t=lower+1
        x = x + (d * t) // g
        y = y - (w * t) // g
        z = n - x - y
        print(x," ",y," ",z)
        #print(y)
        #print(z)

#------------------------template--------------------------#
import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import*
from io import BytesIO, IOBase
def vsInput():
    sys.stdin = open('input.txt', 'r')
    sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
ALPHA='abcdefghijklmnopqrstuvwxyz'
M=1000000007
EPS=1e-6
def value():return tuple(map(int,input().split()))
def array():return [int(i) for i in input().split()]
def Int():return int(input())
def Str():return input()
def arrayS():return [i for i in input().split()]

#-------------------------code---------------------------#
# vsInput()

for _ in range(1):
    n,p,w,d=value()

    # w*x + d*y =p

    if(w==1):
        if(p>n):
            print(-1)
        else:
            print(p,0,n-p)

    else:

        for draws in range(w):

            rem_score=p-draws*d
            wins=rem_score//w

            loose=n-wins-draws

            if(loose>=0 and wins+draws<=n and rem_score%w==0 and wins>0):
                print(wins,draws,loose)
                exit()

        if(p==0):
            print(0,0,n)
        else:
            print(-1)

def main():
    n, p, w, d = (int(i) for i in input().split())
    if p == 0:
        print(0, 0, n)
    elif (0--p//w) > n:
        print(-1)
    elif p % w == 0:
        x = p // w
        print(x, 0, n - x)
    else:
        s = set()
        for r in range(d, p, d):
            if r % d in s:
                break
            s.add(r % d)
            if (p - r) % w == 0 and (p - r) // w < (0--p//w):
                x = (p - r) // w
                y = r // d
                z = n - x - y
                print(x, y, z)
                return
        print(-1)

if __name__ == '__main__':
    main()

import math
import sys

def exgcd(a, b):
    if b == 0:
        return (1, 0)
    else:
        y, x = exgcd(b, a % b)
        y -= x * (a // b)
        return (x, y)

def ceil(x, y):
    return x // y + (x % y != 0)

def output(a, b, n):
    if a < 0 or b < 0:
        return
    if a + b > n:
        return

    print(a, b, n - a - b)
    sys.exit(0)

def main():
    n, p, w, d = [int(x) for x in input().split(' ')]
    g = math.gcd(w, d)
    if p % g != 0:
        print(-1)
        return
    x, y = exgcd(w, d)
    a = w // g
    b = d // g
    g = p // g
    x *= g
    y *= g

    if x < 0:
        t = ceil(-x, b)
        x += t * b
        y -= t * a
    elif y < 0:
        t = ceil(-y, a)
        x -= t * b
        y += t * a

    if x < 0 or y < 0:
        print(-1)
    else:
        #output(x, y, n)
        output(x % b, y + (x // b) * a, n)
        #output(x + (y // a) * b, y % a, n)
        print(-1)

if __name__ == '__main__':
    main()

def solve(n, p, w, d):
    y = 1e18
    if p % w == 0:
        print("{} {} {}".format(p // w, 0, n - p // w))
        return
    for i in range(w):
        if (d * i) % w == 1:
            y = min(y, (p * i) % w)
    x = (p - y * d) // w
    z = n - x - y
    if z < 0 or x < 0 or y == 1e18:
        print(-1)
    else:
        print("{} {} {}".format(x, y, z))

n, p, w, d = [int(x) for x in input().split()]
solve(n, p, w, d)

n, p, w, d = list(map(int, input().split()))
s = p%w
l = [(i*d)%w for i in range(0, w)]
y = l.index(s)
x = (p-y*d)//w
if x+y <= n:
    print(x, y, n-x-y)
else:
    print(-1)

def exgcd(a,b,x,y):
    if b==0:
        x[0]=1
        y[0]=0
        return a
    r=exgcd(b,a%b,y,x)
    y[0]-=(a//b)*x[0]
    return r;

def min_ans(a,b,x,y,n):
    g=exgcd(a,b,x,y)
    if n%g:
        return 0
    x[0]*=n//g
    y[0]*=n//g
    db=b//g
    x[0]=((x[0]%db)+db)%db
    y[0]=(n-a*x[0])//b;
    return g
s=input().split()
n=int(s[0])
p=int(s[1])
w=int(s[2])
d=int(s[3])
x=[0]
y=[0]
g=min_ans(w,d,x,y,p)
x=x[0]
y=y[0]
if g==0:
    print("-1")
else:
    if x+y>n:
        da=w//g
        db=d//g
        if db>=da:
            print("-1")
        else:
            tmp=x+y-n
            tmp=(tmp+da-db-1)//(da-db)
            x+=tmp*db
            y-=tmp*da
            if 0<=x and x<=n and 0<=y and y<=n and 0<=x+y and x+y<=n:
                print("%d %d %d"%(x,y,n-x-y))
            else:
                print("-1")
    else:
        print("%d %d %d"%(x,y,n-x-y))

import sys
range = xrange
input = raw_input

n,p,w,d = [int(x) for x in input().split()]

# x+y+z = n
# x * w + y * d = p

def xgcd(a, b):
    """return (g, x, y) such that a*x + b*y = g = gcd(a, b)"""
    x0, x1, y0, y1 = 0, 1, 1, 0
    while a != 0:
        q, b, a = b // a, a, b % a
        y0, y1 = y1, y0 - q * y1
        x0, x1 = x1, x0 - q * x1
    return b, x0, y0

def sign(x):
    return 1 if x >= 0 else -1

g,x,y = xgcd(w,d)

if p % g != 0:
    print -1
else:
    p //= g

    x *= p
    y *= p

    x0 = d // g
    y0 = -(w // g)

    # x0 < -y0
    # y + k * y0 >= 0
    k = sign(y0) * (-y + abs(y0) - 1)//abs(y0)

    x += k * x0
    y += k * y0

    if x < 0:
        # x + k * x0 >= 0
        k = (-x + x0 - 1)//x0
        x += k * x0
        y += k * y0

    if 0 <= x and 0 <= y and x + y <= n:
        print x,y,n - x - y
    else:
        print -1

# Brute force 2: Keep subtracting it by the larger number

from decimal import Decimal

# HCF
def hcf(a,b):
	if a<b:
		return hcf(b,a)
	while b!=0:
		a,b=b,a%b
	return a

inpu = (input()).split(" ")
inp = [Decimal(x) for x in inpu]
n,p,w,d = inp[0], inp[1], inp[2], inp[3]

flag = 0

if p == 0:
	print("0 0 "+str(n))
else:
	f = hcf(w,d)
	if f != 1:
		rem = p%f
		if rem !=0:
			print(-1)
			flag = 1
		else:
			p = p//f
			d = d//f
			w = w//f

	if flag == 0:
		p = Decimal(p)
		w = Decimal(w)
		d = Decimal(d)
		pp = p/w
		dd = d/w
		l1 = Decimal(p//w)
		l2 = w-1
		i = 0
		while(i<=l2):
			a = pp-dd*i
			if a>=0 and a == int(a) and (int(a)+i<=n):
				print(str(int(a))+" "+str(i)+" "+str(int(n-a-i)))
				break
			i+=1
		else:
			print(-1)

import math
import random

n, p, w, d = map(int, input().split())

output = []

c = (p - d * n) / (w - d)
c = math.ceil(c)

for i in range(d + 1):

	lower = (c - i) / d
	upper = (n - i) / d

	if lower - int(lower) == 0:
		if upper - int(upper) == 0:

			lower = int(lower)
			upper = int(upper)

			a = lower

			condition = True

			while condition == True:

				b = i
				x = d * a + b

				if x >= 0:
					y = (p - x * w) / d

					if y >= 0:
						y = int(y)
						z = n - x - y
						output = [x, y, z]
						condition = False
				a += 1
				if a > upper:
					condition = False

	if len(output) == 3:
		print(x, y, z)
		break

else:
	print(-1)

from math import ceil, floor

def extgcd(a, b):
    if a == 0:
        return (b, 0, 1)
    g, x1, y1 = extgcd(b % a, a)
    x = y1 - (b / a) * x1
    y = x1
    return (g, x, y)

from sys import stdin

# n, p, w, d = map(int, raw_input().split())
n, p, w, d = map(int, stdin.readline().split())
# print(n, p, w, d)
g, x0, y0 = extgcd(w, d)
ans = True
if p % g != 0:
    ans = False
else:
    x0 *= p/g
    y0 *= p/g
    # x=x0+k*d/g
    # x0+k*d/g>=0
    # k>=-x0*g/d
    # x0+k*d/g<=n
    # k<=(n-x0)*g/d
    # y=y0-k*w/g
    # y0-k*w/g>=0, k<=y0*g/w
    # y0-k*w/g<=n, k>=(y0-n)*g/w
    klb = int(max(ceil(-x0*g*1.0/d), ceil((y0-n)*g*1.0/w)))
    kub = int(min(floor((n-x0)*g*1.0/d), floor(y0*g*1.0/w)))
    if d > w:
        kub = min(kub, int(floor(g*1.0*(n-x0-y0)/(d-w))))
    elif d < w:
        klb = max(klb, int(ceil(g*1.0*(n-x0-y0)/(d-w))))
    else:
        pass
    if klb > kub:
        ans = False
    else:
        k = klb
        z = -1
        while k <= kub and (z < 0 or z > n):
            x = x0+k*d/g
            y = y0-k*w/g
            z = n-x-y
            # print("%s %s %s" % (x, y, z))
            k += 1
        if z < 0 or z > n:
            ans = False
if ans:
    print("%s %s %s" % (x, y, z))
else:
    print("-1")

import math
n,p,w,d=map(int,input().split())
if n<(math.ceil(p/w)) or p<w and p<d and p>0:
    print('-1')
if p==n and w>1 and d>1:
    print('-1')
elif p==0:
    print(0,0,n)
else:
    i=0
    while True:
        if (p-i)%w==0:
            x=(p-i)//w
            y=i//d
            break
        i+=d
    print(x,y,n-x-y)

from math import *
from sys import *
from heapq import *
from collections import defaultdict
import os, sys
from io import IOBase, BytesIO
M=10**9+7
def pow(a,b):
    res=1
    while b>0:
        if b&1:
            res*=a
        a*=a
        b>>=1
    return res
def powmod(a,b,m):
    res=1
    while b>0:
        if b&1:
            res=((res*a)%m)
        a*=a
        b>>=1
    return res
def inv(a,m):
    return powmod(a,m-2,m)
def alldivisors(n) :
    list = []
    arr=[]
    for i in range(1, int(sqrt(n) + 1)) :
        if (n % i == 0) :
            if (n / i == i) :
                arr+=[i]
            else :
                arr+=[i]
                list.append(n//i)
    arr+=list[::-1]
    return arr
def primefactorisation(n):
    potentional_p = 3
    itog_list = defaultdict(int)
    if n % 2 == 0:
        itog_list[2] = 0
    while n % 2 == 0:
        n = n // 2
        itog_list[2] += 1
    while n - 1:
        if potentional_p > (n**0.5):
            itog_list[n] += 1
            return itog_list
        while n % potentional_p == 0:
            n = n // potentional_p
            itog_list[potentional_p] += 1
        potentional_p += 2
    return itog_list

def main():
    n,p,w,d=list(map(int,input().split()))
    gd=gcd(w,d)
    if p%gd==0:
        p=p//gd
        w=w//gd
        d=d//gd
    else:
        print(-1)
        exit(0)
    x_i=p/w
    y_i=p/d

    if y_i<x_i:
        x=0
        while 1:
            val=p-x*w
            if val%d==0:
                if val>=0 and n-x-val//d>=0:
                    print(x,val//d,n-x-val//d)
                    break
                else:
                    print(-1)
                    break
            x+=1
    else:
        #print("here")
        y=0
        while 1:
            val=p-y*d
            if val%w==0:
                print(p,d,val,w)
                if val>=0 and n-y-val//w>=0:
                    print(val//w,y,n-y-val//w)
                    break
                else:
                    print(-1)
                    break
            y+=1

BUFSIZE = 8192
class FastIO(BytesIO):
    newlines = 0

    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0,2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        while self._fill(): pass
        return super(FastIO,self).read()

    def readline(self):
        while self.newlines == 0:
            s = self._fill(); self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.getvalue())
            self.truncate(0), self.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s:self.buffer.write(s.encode('ascii'))
        self.read = lambda:self.buffer.read().decode('ascii')
        self.readline = lambda:self.buffer.readline().decode('ascii')

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip('\r\n')

if __name__ == '__main__':
    main()
#threading.Thread(target=main).start()

#Problem 3 more elegant
n, p, w, d = map(int,input().split())
p_max = n*w
w_count = 0
d_count = 0
score = 0
if p_max < p:
    print("-1")
else:
    maxwins = int(p/w)
    if w*maxwins > p:
        maxwins = maxwins -1
    print(maxwins)
    n -= maxwins
    score = maxwins * w
    w_count += maxwins
    if score == p:
        print(int(w_count), 0, int(n))
    else:
        while score < p:
            scorediff = p - score
            if scorediff % d == 0:
                if n >=  scorediff/d:
                    d_count += scorediff/d
                    n -= d_count
                    print(int(w_count), int(d_count), int(n))
                    break
                else:
                    print(-1)
                    break
            else:
                score -= w
                w_count -= 1
                n +=  1
                if n * d < p - score:
                    print(-1)
                    break

n,p,w,d=map(int,input().split())
x=p//w
remp=p-(x*w)
# print(remp)
y=remp//d
baaki=remp-(y*d)
if baaki!=0:
	print(-1)
else:
	print(x,y,(n-(x+y)))

n,p,w,l=map(int,input().split())
a,b=0,0
c=[False for i in range(l+1)]
d=0
if(n*w<p):
    print(-1)
elif(p==0):
    print(0,0,n)
else:
    a=p//w
    d=p%w
    while (a>=0):
        if(d%l==0 or c[d%l]==True):
            break
        c[d%l]=True
        a-=1
        d+=w
    b=d//l
    if(a+b<=n and a>=0):
        print(a,b,n-a-b)
    else:
        print(-1)

def egcd(a, b):
  x,y, u,v = 0,1, 1,0
  while a != 0:
    q, r = b//a, b%a
    m, n = x-u*q, y-v*q
    b,a, x,y, u,v = a,r, u,v, m,n
  gcd = b
  return int(gcd), int(x), int(y)

n, D, a, b = map(int, input().split())

swap = 0
if (a > b):
    a, b = b, a
    swap = 1

d, x, y = egcd(a, b)

if (D%d != 0):
  print ("-1")
  exit()

x *= D//d;
y *= D//d;

if (x < 0):
  up = ( (1 - x) + (b//d - 1) ) // (b//d);
  x += (b//d) * up;
  y -= (a//d) * up;

if (x > b//d):
  drop = (x-1) // (b//d);
  x -= b//d * drop;
  y += a//d * drop;

if (y < 0):
  print ("-1")
  exit()

if (swap):
    x, y = y, x

rem = n - (x+y)
if (rem < 0):
    print (-1)
else:
    print (x, y, rem)

'''
    Author : thekushalghosh
    Team   : CodeDiggers
'''
import sys,math
input = sys.stdin.readline
n,p,w,d = map(int,input().split())
a = max(0,(p // w) - 50000)
b = min(n,a + 50000)
if p == 0:
    print(0,0,n)
    sys.exit()
if p < w:
    print(0,p // d,n - (p // d))
    sys.exit()
for i in range(a,b):
    if w * (i + 1) <= p and (p - (w * (i + 1))) % d == 0:
        q = (p - (w * (i + 1))) // d
        if q + i + 1 <= n:
            if p != 0:
                print(i + 1,q,n - q - i - 1)
                sys.exit()
            else:
                print(0,0,n)
print(-1)

inp = input()
n, p,w,d = [int(e) for e in inp.split(" ")]
if(p == 0):
    x = 0
    y = 0
    z = n
    print(x, end=" ")
    print(y, end=" ")
    print(z)
elif(w*n < p or (w*n > p and (p % w)%d != 0)):
    print(-1)
else:
    x = p // w
    y = (p % w) // d
    z = n - x - y
    print(x, end=" ")
    print(y, end=" ")
    print(z)

from math import ceil
global x, y

def gcd(a, b, x, y):
    if (a == 0):
        x[0], y[0] = 0, 1
        return b
    x1, y1 = [0], [0]
    d = gcd(b%a, a, x1, y1)
    x[0] = y1[0] - (b // a) * x1[0]
    y[0] = x1[0]
    return d

def find_any_solution(a, b, c, x0, y0, g):
    if (a < 0): a = -a
    if (b < 0): b = -b
    g[0] = gcd(a, b, x0, y0)
    if (c % g[0]):
        return False
    x0[0] *= c // g[0]
    y0[0] *= c // g[0]
    if (a < 0): x0[0] = -x0[0]
    if (b < 0): y0[0] = -y0[0]
    return True

n, p, d, w = list(map(int, input().split()))

x, y, g = [0], [0], [0]
can = find_any_solution(w, d, p, x, y, g)
x, y, g = x[0], y[0], g[0]
if (can):
    dx, dy = d // g, w // g
    # DEBUG printf("## %lld %lld | %lld %lld\n", x, y, dx, dy)
    if (x < 0):
        needed = ceil(-x / dx)
        # DEBUG printf("xx %lld %lld %lld\n", x, dx, needed)
        x += needed * dx
        y -= needed * dy
    if (y < 0):
        needed = ceil(-y / dy)
        # DEBUG printf("yy %lld %lld %lld\n", x, dx, needed)
        x -= needed * dx
        y += needed * dy
    # // while (x + y > n and x >= 0 and y >= 0)
    # // {
    # //   // if (x >= y)
    # //   // {
    # //   //   lli needed = ceil((ldouble) (x - n) / dx)
    # //   //   x -= needed * dx, y += needed * dy
    # //   // }
    # //   // else
    # //   // {
    # //   //   lli needed = ceil((ldouble) (y - n) / dy)
    # //   //   x += needed * dx, y -= needed * dy
    # //   // }
    # // }
    while ((x + y > n or x < 0) and y >= 0):
        x += dx
        y -= dy
    while ((x + y > n or y < 0) and x >= 0):
        x -= dx
        y += dy
    # DEBUG printf("## %lld %lld\n", x, y)
    if (x + y > n or x < 0 or y < 0): print("-1")
    else: print(x, y, n - (x + y))
else:
    print("-1")

def main():
    n, p, w, d = (int(i) for i in input().split())
    if p == 0:
        print(0, 0, n)
    elif (0--p//w) > n:
        print(-1)
    elif p % w == 0:
        x = p // w
        print(x, 0, n - x)
    else:
        for y in range(10**6 + 5):
            less = p - y * d
            if less % w == 0:
                x = less // w
                print(x, y, n-x-y)
                break
        else:
            print(-1)

if __name__ == '__main__':
    main()

def gcd(a, b, x, y):
  if(b == 0):
    x = 1
    y = 0
    return (a, x, y)

  d, x1, y1 = gcd(b, a%b, x, y)
  x = x1
  y = x1 - y1*(a // b)

  return (d, x, y)

def find_any_solution(a, b, c, x0, y0, g):
  g, x0, y0 = gcd(a, b, x0, y0)
  if c % g:
      return (-1, x0, y0)

  x0 *= c//g
  y0 *= c//g

  if a < 0:
      x0 = -x0
  if b < 0:
      y0 = -y0;

  return (g, x0, y0)

def main():
  entrada = input("")
  entrada = entrada.split(' ')
  n, p, w, d = entrada
  n = int(n)
  p = int(p)
  w = int(w)
  d = int(d)

  x = None
  y = None
  g = None

  g, x, y = find_any_solution(w, d, p, x, y, g)
  if g == -1:
      print(-1)
      return 0
  w //= g
  d //= g

  if(y < 0):
      k = abs(y//w);

      y += k*w
      x -= k*d

      if y < 0:
          y += w
          x -= d

  if(x < 0):
      k = abs(x/d);

      y -= k*w;
      x += k*d;

      if(x < 0):
          y -= w;
          x += d;

  if(y > 0):
      k = abs(y/w);

      y -= k*w;
      x += k*d;

  N = n - x - y;

  if(x < 0 or y < 0 or (n - x - y < 0)):
    print(-1)
  else :
    print(x, " ", y, " ",N)

main()

import math
if __name__ == '__main__':
    [match, point, win, draw] = [int(z) for z in input().split()]
    def gcd(a, b):
        while b:
            a %= b
            a, b = b, a
        return a

    def extended_euclid(a, b):
        xx = 0
        y=  0
        yy = 1
        x = 1
        while b:
            q = a//b
            t = b
            b = a % b
            a = t
            t =xx
            xx = x - q * xx
            x=t
            t = yy
            yy= y- q * yy
            y=t
        return x, y

    def LinearDiophantine(a, b, c):
        d = gcd(a, b)
        if c % d != 0:
            return -1, -1
        x, y = extended_euclid(a, b)
        a //= d
        b //= d
        x *= c // d
        y *= c // d
        if x < 0 :
            kay = int(math.ceil(x * -1.0 / b))
            x += b * kay
            y -= a * kay

        if y < 0:
            kay = int(math.ceil(y * -1.0 / a))
            x -= b * kay
            y += a * kay

        if x < 0 or y  < 0:
            return x, y

        if x + y <= match:
            return x, y

        if b > a:
            kay = x // b
            x %= b
            y += a * kay
        else:
            kay = y // a
            y %= a
            x += b * kay

        if x + y <= match:
            return x, y
        return -1, -1

    wi, dr = LinearDiophantine(win, draw, point)
    if wi < 0 or dr < 0:
        print(-1)
        exit(0)
    print('{} {} {}'.format(wi, dr, match - wi - dr))

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a%b)

def exgcd(a, b, d):
	if b == 0:
		d = a
		x = 1
		y = 0
		return d, x, y
	d, y, x = exgcd(b, a%b, d)
	y = y - x*(a//b)
	return d, x, y

def Calc(x, y):
	if y == 1:
		return x
	return (x + y - 1) // y

def main():
	n, p, w, d = map(int, input().split(" "))
	g = gcd(d, w)

#	print(g)
	if p % g > 0:
#		print("-1");
		return
	p = p // g
	w = w // g
	d = d // g
	tmp = 0
	x = 0
	y = 0
	d, x, y = exgcd(w, d, tmp)
	x = x * p
	y = y * p
#	print(str(x) + " " + str(y))
	if y < 0 :
		add = Calc(-y, w)
		y += add * w
		x -= add * d
		if x < 0 or x + y > n:
			print("-1")
		else :
			print(str(x) + " " + str(y) + " " + str(n - x - y))
		return

	add = y // w
	y -= add * w
	x += add * d
	if x < 0 or x + y > n :
		print("-1")
	else:
		print(str(x) + " " + str(y) + " " + str(n - x - y))
	return

main()

n,p,w,d=list(map(int,input().split()))
flag=0
for i in range(w+1):
    if (p-(i*d))%w==0:
        y=i
        x=(p-(i*d))//w
        z=n-(x+y)
        flag=1
        break
if flag==0 or z<0:
    print(-1)
else:
    print(*[x,y,z])

n,p,w,d=[int(i) for i in input().split(" ")]

def exgcd(a,b):
    if b==0:
        return (1,0)
    tx,ty=exgcd(b,a%b)
    return (ty,tx-a//b*ty)

def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)

x,y=exgcd(w,d)
g=gcd(w,d)
if p%g!=0:
    print("-1")
    exit()
p//=g
x*=p
y*=p
w/=g
d/=g
if x<0:
    tmp=(-x+d-1)//d
    x+=tmp*d
    y-=tmp*w
if y<0:
    tmp=(-y+w-1)//w;
    y+=tmp*w
    x-=tmp*d
if x<0:
    print("-1")
    exit()
if y>=w:
    tmp=y//w
    y-=tmp*w;
    x+=tmp*d;
if x+y>n:
    print("-1")
    exit()
print(int(x),int(y),int(n-x-y))

def exgcd(a, b):
    if a == 0:
        return (b, 0, 1)
    else:
        g, x, y = exgcd(b % a, a)
        return (g, y - (b // a) * x, x)

if __name__ == "__main__":
    n, p, w, d = map(int, input().split())
    r, x, y = exgcd(w, d)
    if p % r:
        print(-1)
    else:
        x = p // r * x
        y = p // r * y
        d = d // r
        w = w // r
        y0 = ((y % w) + w) % w
        x0 = (p / r - y0 * d) // w
        if x0 >= 0 and y0 >= 0 and x0 + y0 <= n:
            print("%d %d %d" % (x0, y0, n - x0 - y0))
        else:
            print(-1)

a,b,c,d = map(int,input().split())
if a*c<b:
    print(-1)
else:
    x = b//c
    while x>=0:
        y = (b-x*c)%d
        if  y==0:
            print(x,y,a-x-y)
            exit(0)
        else:
            x-=1
    print(-1)

import math
def gcd(a,b):
    if a==0:
        x0=0
        y0=1
        return b,x0,y0
    d=gcd(b%a,a)
    x0=d[2]-(b//a)*d[1]
    y0=d[1]
    return d[0],x0,y0

s=list(map(int,input().split()));
n=s[0]
p=s[1]
w=s[2]
d=s[3]
dd=gcd(w,d)
x0=dd[1]
y0=dd[2]
dd=dd[0]
x0*=p//dd
y0*=p//dd
dy=w//dd
dx=d//dd
if p%dd !=0:
    print(-1)
    exit()
else:
    if y0<0:
        col=math.ceil(abs(y0)/dy)
        y0+=dy*col
        x0-=dx*col
    if x0<0:
        print(-1)
        exit()
    col=y0//dy
    y0-=dy*col
    x0+=dx*col
    if(x0+y0<=n):
        print(x0,y0,n-x0-y0)
    else:
        print(-1)

def gcdExtended(a, b, x, y):
	if a == 0:
		x = 0
		y = 1
		return b,x,y
	x1 = 0
	y1 = 0
	gcd,x1,y1 = gcdExtended(b%a, a, x1, y1)

	x = y1 - (b//a) * x1
	y = x1
	return gcd,x,y

def find_one(a,b,c,g):
	g,x0,y0 = gcdExtended(a,b,0,0)

	x0 *= c // g
	y0 *= c // g
	if a < 0:
		x0 = -x0
	if b < 0:
		y0 = -y0
	return x0,y0

def gcd(a,b):
	if(b == 0):
		return a
	return gcd(b,a%b)

n,p,w,d = map(int,input().split())
g = gcd(w,d)
if(p % g):
	print("-1")
else:
	a,b = find_one(w,d,p,g)
	p1 = w//g
	p2 = d//g
	l = -1e13
	r = 1e13
	while(l <= r):
		mid = (l+r)//2
		x = a + mid*p2
		y = b - mid*p1
		if(x >= 0 and y >= 0 and ((x+y) <= n)):
			print(int(x),int(y),int(n-x-y))
			exit(0)
		elif(x < 0):
			l = mid+1;
		elif(y < 0):
			r = mid-1;
		elif(x + y > n):
			l = mid+1;
print("-1")

#592_C

import math

def lcm(a, b):
    return (a * b) // math.gcd(a, b)

ln = [int(i) for i in input().split(" ")]

n = ln[0]
p = ln[1]
w = ln[2]
d = ln[3]

lm = lcm(w, d)
pd = p % lm
cd = p - pd

x = cd // w
y = 0
f = False
if pd == 0:
    f = True

for i in range(0, pd // w + 2):
    if (pd - (w * i)) % d == 0:
        x += i
        y = (pd - (w * i)) // d
        f = True
        break

if f:
    z = n - x + y
    if z < 0:
        print(-1)
    else:
        print(x, y, z)
else:
    print(-1)

import math
import sys

n, p, w, d = list(map(int, input().split()))

def egcd(a, b):
    if a == 0:
        return b, 0, 1
    else:
        g, y, x = egcd(b % a, a)
        return g, x - (b // a) * y, y

g = math.gcd(w, d)

if(p % g != 0):
    print(-1)
    sys.exit(0)

_, X, Y = egcd(w, d)

m = p / g
X *= m
Y *= m

w2 = w / g
d2 = d / g

a = d2
b = X
c = -w2
e = Y

lt = int(math.ceil(-(b / a)))
gt = int(math.floor(-(e / c)))

if(gt < lt):
    print(-1)
    sys.exit(0)

tans = gt
x = int(a * tans + b)
y = int(c * tans + e)
z = n - x - y

if(z < 0):
    print(-1)
else:
    print(x, y, z)

from __future__ import division, print_function
def main():
    n,p,w,d=map(int,input().split())
    wins=0
    def gcd(a,b):
        while b:
            a,b=b,a%b
        return a
    lcm=(w*d)//gcd(w,d)
    x=lcm//w
    while (wins*w)<=lcm and wins<n and (p-wins*w)%d!=0:
        wins+=1

    if (p-wins*w)%d==0:
        low=0
        high=(n-wins)//x

        while low<=high:
            mid=(high+low)//2
            a=mid*x+wins
            if p<a*w:
                high=mid-1
                continue
            if (a+(p-a*w)//d)>n:
                low=mid+1
            elif (a+(p-a*w)//d)<n:
                high=mid-1
            else :
                break
        draws=(p-a*w)//d
        if a+draws<=n:
            print(a,draws,n-a-draws)
        else :
            print(-1)
    else :
        print(-1)

######## Python 2 and 3 footer by Pajenegod and c1729

# Note because cf runs old PyPy3 version which doesn't have the sped up
# unicode strings, PyPy3 strings will many times be slower than pypy2.
# There is a way to get around this by using binary strings in PyPy3
# but its syntax is different which makes it kind of a mess to use.

# So on cf, use PyPy2 for best string performance.

py2 = round(0.5)
if py2:
    from future_builtins import ascii, filter, hex, map, oct, zip
    range = xrange

import os, sys
from io import IOBase, BytesIO

BUFSIZE = 8192
class FastIO(BytesIO):
    newlines = 0

    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0,2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        while self._fill(): pass
        return super(FastIO,self).read()

    def readline(self):
        while self.newlines == 0:
            s = self._fill(); self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.getvalue())
            self.truncate(0), self.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            self.write = lambda s:self.buffer.write(s.encode('ascii'))
            self.read = lambda:self.buffer.read().decode('ascii')
            self.readline = lambda:self.buffer.readline().decode('ascii')

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip('\r\n')

# Cout implemented in Python
import sys
class ostream:
    def __lshift__(self,a):
        sys.stdout.write(str(a))
        return self
cout = ostream()
endl = '\n'

# Read all remaining integers in stdin, type is given by optional argument, this is fast
def readnumbers(zero = 0):
    conv = ord if py2 else lambda x:x
    A = []; numb = zero; sign = 1; i = 0; s = sys.stdin.buffer.read()
    try:
        while True:
            if s[i] >= b'0' [0]:
                numb = 10 * numb + conv(s[i]) - 48
            elif s[i] == b'-' [0]: sign = -1
            elif s[i] != b'\r' [0]:
                A.append(sign*numb)
                numb = zero; sign = 1
            i += 1
    except:pass
    if s and s[-1] >= b'0' [0]:
        A.append(sign*numb)
    return A

if __name__== "__main__":
  main()

import math

def input_int():
    return list(map(int, input().split()))

def solve():
    [n, p, w, d] = input_int()
    lo = 0
    hi = n
    wins = hi
    while wins != lo:
        wins = (lo + hi) // 2
        win_points = wins * w
        points_left = p - win_points
        if points_left < 0:
            hi = wins
            continue
        draws = min(points_left // d, n - wins)
        leftover_points = points_left - draws * d
        losses = n - wins - draws
        if leftover_points == 0:
            print(wins, draws, losses)
            return
        if leftover_points > 0:
            lo = wins
            continue
    print(-1)
    return

solve()

from collections import defaultdict as dc
from collections import deque as dq
from bisect import bisect_left,bisect_right,insort_left
import sys
import math
#define of c++ as inl=input()
mod=10**9 +7
def bs(a,x):
    i=bisect_left(a,x)
    if i!=len(a) and a[i]==x:
        return i
    else:
        return -1
def inp():
    p=sys.stdin.readline()
    return p
def line():
    p=list(map(int,inp().split()))
    return p
n,p,w,d=line()
k=0
for y in range(w+1):
    l=p%w - ((y%w)*(d%w))%w
    if l%w==0:
        k=1
        x=(p-y*d)//w
        break
if k==1 and x+y<=n:
    print(x,y,n-(x+y))
else:
    print(-1)

n,p,w,d=map(int, input().split(' '))
x=p//w
for y in range(0,w):
    if((y*d - p%w)%w==0):
        x-=((y*d-p%w)//w)
        break
z=n-x-y
if(x+y<=n and y<w and x>=0):
    print("%d %d %d"%(x,y,z))
else:
    print("-1")

def gcd(a, b):
    if (a == 0):
        return (b, 0, 1)

    d, x1, y1 = gcd(b % a, a)

    return (d, y1 - (b // a) * x1, x1)

SuperINF = 2e18

n, p, w, d = map(int, input().split())

NOD, x, y = gcd(d, w)
if (p % NOD != 0):
    print(-1)
else:
    d //= NOD
    w //= NOD
    p //= NOD

    x, y = x * p, y * p

    ost = (x + SuperINF * w) % w

    x = ost

    y = (p * NOD - x * NOD * d) // ( NOD * w)

    if (y < 0):
        print(-1)
    elif (x + y > n):
        print(-1)
    else:
        ans1 = y
        ans2 = x
        ans3 = n - x - y
        print(ans1, ans2, ans3)

def gcd(a, b):
    if a == 0:
        return (b, 0, 1)
    d, x1, y1 = gcd(b%a, a)
    x = y1 - (b // a) * x1
    y = x1
    return (d, x, y)

import math

def fas(a, b, c):
    g, x, y = gcd(abs(a), abs(b))
    if c % g != 0:
        return (False, 0, 0)
    x *= c // g
    y *= c // g
    if (a < 0):
        x *= -1
    if (b < 0):
        y *= -1
    return (True, x, y, g)

n, p, w, d = map(int, input().split())

can, x, y, g  = fas(w, d, p)

if can == False:
    print(-1)
    exit(0)

w //= g
d //= g

if (y > x):
    cnt = y // w
    print(cnt)
    y -= cnt * w
    x += cnt * d

#print(x, y)

if (y < 0):
    cnt = -y // w
    if y % w != 0:
        cnt += 1
    cnt = -cnt
    #print(cnt)
    y -= cnt * w
    x += cnt * d

#print(x, y)

if (x + y <= n and x >= 0 and y >= 0):
    print(x, y, n - x - y)
else:
    print(-1)

def gcdExtended(a, b, x, y):
	if a == 0:
		x = 0
		y = 1
		return b,x,y
	x1 = 0
	y1 = 0
	gcd,x1,y1 = gcdExtended(b%a, a, x1, y1)

	x = y1 - (b//a) * x1
	y = x1
	return gcd,x,y

def find_one(a,b,c,g):
	g,x0,y0 = gcdExtended(a,b,0,0)

	x0 *= c // g
	y0 *= c // g
	if a < 0:
		x0 = -x0
	if b < 0:
		y0 = -y0
	return x0,y0

def gcd(a,b):
	if(b == 0):
		return a
	return gcd(b,a%b)

n,p,w,d = map(int,input().split())
g = gcd(w,d)
if(p % g):
	print("-1")
else:
	a,b = find_one(w,d,p,g)
	p1 = w//g
	p2 = d//g
	l = -1e30
	r = 1e30
	while(l <= r):
		mid = (l+r)//2
		x = a + mid*p2
		y = b - mid*p1
		if(x >= 0 and y >= 0 and ((x+y) <= n)):
			print(int(x),int(y),int(n-x-y))
			exit(0)
		elif(x < 0):
			l = mid+1;
		elif(y < 0):
			r = mid-1;
		elif(x + y > n):
			l = mid+1;
print("-1")

def exgcd(a, b):
    if b == 0:
        return a, 1, 0
    d, x, y = exgcd(b, a % b)
    t = x
    x = y
    y = t - (a // b) * y
    return d, x, y

n, p, w, d = map(int, input().split())
g, x, y = exgcd(w, d)
if p % g != 0:
    print(-1)
else:
    if x < 0:
        t = (-x + d - 1) // d
        x += t * d
        y -= t * w
    if y < 0:
        t = (-y + w - 1) // w
        x -= t * d
        y += t * w
    if x < 0 or y < 0:
        print(-1)
    else:
        x *= p // g
        y *= p // g
        t = y // w
        x += t * d
        y -= t * w
        if x + y <= n:
            print(x, y, n - x - y)
        else:
            print(-1)

n,p,w,d=map(int,input().split())
temp=0
if p==0:
    print('0','0',n);exit()
for x in range(p//w,p//w-1000,-1):
    if (p-x*w)%d==0 and x+(p-x*w)/d<=n:
        temp=1
        y=(p-x*w)//d;break
    elif (p-x*d)%w==0 and x+(p-x*d)/w<=n:
        temp=1;y=x;x=(p-y*d)//d;break

print(x,y,n-x-y) if temp==1 else print('-1')

from collections import defaultdict as dc
from collections import deque as dq
from bisect import bisect_left,bisect_right,insort_left
import sys
import math
#define of c++ as inl=input()
mod=10**9 +7
def bs(a,x):
    i=bisect_left(a,x)
    if i!=len(a) and a[i]==x:
        return i
    else:
        return -1
def inp():
    p=sys.stdin.readline()
    return p
def line():
    p=list(map(int,inp().split()))
    return p
def value(w,d,x,y,p):
    l=x*w + y*d
    if l==p:
        return 1
    elif l<p:
        return 0
    else:
        return -1
def binary(x,w,d,n,p):
    #print('draw')
    l=0
    r=n-x
    while(l<=r):
        mid=(l+r)//2
        q=value(w,d,x,mid,p)
        if q==1:
            return 1,mid
        elif q==0:
            l=mid+1
        else:
            r=mid-1
    return value(w,d,x,mid,p),mid
n,p,w,d=line()
l=0
r=n
x='a'
while(l<=r):
    mid=(l+r)//2
    #print(l,r)
    z,y=binary(mid,w,d,n,p)
    if z==1:
        x=mid
        break
    elif z==0:
        l=mid+1
    else:
        r=mid-1
if x=='a':
    print(-1)
else:
    print(x,y,(n-x-y))

import sys
from fractions import gcd
n, p, w, d = [int(item) for item in input().split()]
div = gcd(w, d)
if p % div != 0:
    print(-1)
else:
    p //= div
    w //= div
    d //= div
    ans = False
    reverse = False
    if w < d:
        w, d = d, w
        reverse = True
    for x in range(p // w, max(-1, p // w - 10**5), -1):
        if (p - x * w) % d != 0:
            continue
        y = (p - x * w) // d
        if y < 0 or x + y > n:
            continue
        ans = True
        break
    if ans:
        if reverse:
            print(x, y, n - x - y)
        else:
            print(y, x, n - x - y)
    else:
        print(-1)

from sys import setrecursionlimit
setrecursionlimit(10**6)
def extgcd(a,b,x,y):
    if b==0:
        x[0]=1
        y[0]=0
        return a
    e=extgcd(b,a%b,y,x)
    y[0]-=(a//b)*x[0]
    return e

n,p,w,d=map(int,input().split())
from math import gcd
if p%gcd(w,d)!=0:
    print(-1)
    exit()
if p==0:
    print(0,0,n)
    exit()
h=p//gcd(w,d)
x,y=[0],[0]
extgcd(w,d,x,y)
x=x[0]*h
y=y[0]*h
if y>=0:
    g=y//w
    x+=g*d
    y-=g*w
else:
    g=-(y//w)
    x-=g*d
    y+=g*w
if x<0 or x+y>n:
    print(-1)
else:
    print(x,y,n-x-y)

list1=[int(x) for x in input().split(' ')]
n=list1[1]
c=n % list1[2]
if c != 0 and list1[2] % list1[3] == 0:
    print(-1)
else:
    while c != 0:
        n-=list1[3]
        c=n % list1[2]
    a=int(n/list1[2])
    b=int((list1[1]-n)/list1[3])
    if (a+b > list1[0]) or (a < 0):
        print(-1)
    else:
        print(a,b,list1[0]-a-b,sep=' ')

def gcd(a,b):
	global x,y
	if(a==0):
		x=0
		y=b
		return b
	else:
		g=gcd(b%a,a)
		x2=y-(b//a)*x
		y=x
		x=x2
		return g

def min(a,b):
	if(a>b):
		return b
	return a

def max(a,b):
	if(a<b):
		return b
	return a

n,p,w,d=map(int,input().split())
x=0
y=0
g=gcd(w,d)
if(not p%g==0):
	print(-1)
else:
	swap=False
	p=p//g
	w2=w
	d2=d
	x=x*p
	y=y*p
	if(x>y):
		temp=x
		x=y
		y=temp
		temp=d2
		d2=w2
		w2=temp
		swap=True
	lb=0
	ub=100000000000000000000000000
	lb=max(lb,(-x+d2-1)//d2)
	ub=min(ub,(n-x)//d2)
	ub=min(ub,(n-x)//d2)
	lb=max(lb,(y-n+w2-1)//w2)
	if(d2-w2>0):
		ub=min(ub, (n-x-y)//(d2-w2))
		lb=max(lb, (-x-y+d2-w2-1)//(d2-w2))
	elif(w2-d2>0):
		ub=min(ub, (x+y)//(w2-d2))
		lb=max(lb, (x+y-n+w2-d2-1)//(w2-d2))
	if(lb<=ub):
		v1=x+lb*d2
		v2= y-lb*w2
		v3=n-v1-v2
		if(v1>=0 and v2>=0 and v3>=0):
			if(not swap):
				print(v1,v2,v3)
			else:
				print(v2,v1,v3)
		else:
			print(-1)
	else:
		print(-1)

n, p, w, d = [int(x) for x in input().split()]

pW = p // w
pD = 0
while pW >= 0:
  pD = p - pW * w
  if pD % d == 0:
    break
  pW -= 1

if pW < 0 or pW + pD > n:
  print("-1")
else:
  print("%s %s %s" % (pW, pD, (n - pW - pD)))

def solve():
    n,p,w,d=map(int,input().split())
    x=p//w
    y=(p-x*w)/d
    if y!=int(y):
        print(-1)
        return
    else:
        y=int(y)
    z=n-x-y
    if z<0:
        print(-1)
        return
    print(x,y,z)

solve()

import sys, bisect, heapq, math
sys.setrecursionlimit(10**9+7)
def fi(): return int(sys.stdin.readline())
def fi2(): return map(int, sys.stdin.readline().split())
def fi3(): return sys.stdin.readline().rstrip()
def fo(*args):
    for s in args: sys.stdout.write(str(s)+' ')
    sys.stdout.write('\n')
##    sys.stdout.flush()
def puts(*args):
    for s in args: sys.stdout.write(str(s))
OUT = []
def bfo(*args):
    for s in args: OUT.append(str(s)+' ')
    OUT.append(' ')
def bputs(*args):
    for s in args: OUT.append(str(s))
def flush():
    sto = ''.join(OUT); fo(sto)
##
alpha = 'abcdefghijklmnopqrstuvwxyz'; mod = 10**9+7; inf = int(2e18+5) ; nax = 101010
##

def gcdExtended(a, b):
    if a == 0 :
        x = 0
        y = 1
        return (x, y)

    x1, y1 = gcdExtended(b%a, a)

    x = y1 - (b//a) * x1
    y = x1

    return (x, y)

n, p, w, d = fi2()

g = math.gcd(w, d)
x, y = gcdExtended(w, d)

if p%g != 0:
    print(-1)
    exit()

x = x*p//g
y = y*p//g

assert(w*x + y*d == p)

if y < 0:
    k = abs(y)//w + 5
    y += w*k
    x -= d*k

k = y//w
y -= w*k
x += d*k

assert(w*x + y*d == p)

z = n - x - y

if x >= 0 and y >= 0 and z >= 0:
    print(x, y, z)
else:
    print(-1)