A, B, C, D, N = map(int, input().split()) P, Q, R, S, T = map(int, input().split()) def func(n, t): if C+D < n: return -1, -1 if R == S: if t%R == 0 and t <= R*n: c, d = 0, 0 c = min(t//R, C) if c*R < t: d = t//R-C return c, d else: return -1, -1 else: top = S*n-t bottom = S-R if top%bottom == 0: c = top//bottom if 0 <= c <= C and 0 <= n-c <= D: return c, n-c else: return -1, -1 else: return -1, -1 for a in range(A+1): if N < a: break if T < P*a: break for b in range(B+1): if N < a+b: break if T < P*a+Q*b: break n = N-a-b t = T-P*a-Q*b c, d = func(n, t) if c != -1: exit(print(a, b, c, d))