A, B, C, D, N = map(int, input().split()) P, Q, R, S, T = map(int, input().split()) def solve(): if S == R: return None for a in range(A): for b in range(B): n = N - a - b t = T - a*P - b*Q d = (t - n*R) // (S - R) c = n - d 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)