""" cR + dS = trem c+d = nrem cR + (nrem-c)S = trem (R-S)c = trem-nremS """ import sys import math def extGCD(a,b): g = math.gcd(a,b) x, y, u, v = 1, 0, 0, 1 while b: k = a // b x -= k * u y -= k * v x, u = u, x y, v = v, y a, b = b, a % b return g ,x, y def extinv(a,mod): g,x,y = extGCD(a,mod) if g != 1: return -1 if x > 0: return x else: return x + mod # X^K = Y (mod M) from math import ceil, sqrt def BsGs(X,Y,M): dic = {} dic[1] = 0 sq = ceil(M**0.5) #baby-step Z = 1 for i in range(sq): Z = Z * X % M if Z not in dic: dic[Z] = i+1 if Y in dic: return dic[Y] #giant-step R = extinv(Z,M) for i in range(1,sq+1): Y = Y * R % M if Y in dic: return dic[Y] + i * sq return -1 def crt2(b1,m1,b2,m2): g,p,q = extGCD(m1,m2) if b1 % g != b2 % g: return 0,0 return ( b1 + m1 * ((b2-b1)//g) * p ) % (m1*m2//g) , m1*m2//g def crt(b,m): assert len(b) == len(m) nb,nm = 0,1 for i in range(len(b)): nb,nm = crt2(nb,nm,b[i],m[i]) if (nb,nm) == (0,0): return 0,0 return nb,nm A,B,C,D,N = map(int,input().split()) P,Q,R,S,T = map(int,input().split()) g = math.gcd(R,S) _,X,Y = extGCD(R,S) for a in range(A+1): for b in range(B+1): trem = T - a * P - b * Q if trem % g != 0: continue nrem = N - a - b # (R-S)c = trem-nremS if R != S: if (trem-nrem*S) % (R-S) != 0: continue c = (trem-nrem*S) // (R-S) d = nrem - c else: c = min(C, trem//R) d = nrem-c if (a + b + c + d == N) and 0 <= c <= C and 0 <= d <= D and a*P + b*Q + c*R + D*S == T: print (a,b,c,d) sys.exit()