A, B, C, D, N = map(int, input().split()) P, Q, R, S, T = map(int, input().split()) def solve(): for a in range(A+1): if a+B+C+D < N: continue for b in range(B+1): n = N - a - b t = T - a*P - b*Q if S == R: if n*R != t: continue # c と d は同じ問題とみなせる c = min(C, n) d = n - c if not (0 <= d <= D): continue if a+b+c+d == N and a*P + b*Q + c*R + d*S == T: return a, b, c, d else: if (t - n*R) % (S - R) != 0: continue d = (t - n*R) // (S - R) c = n - d if not (0 <= c <= C): continue if not (0 <= d <= D): continue if a+b+c+d == N and a*P + b*Q + c*R + d*S == T: return a, b, c, d return None ans = solve() if ans is None: print(-1) else: print(*ans)