A, B, C, D, N = map(int, input().split()) P, Q, R, S, T = map(int, input().split()) for a in range(A + 1): for b in range(B + 1): rem_n = N - a - b rem_t = T - a * P - b * Q if R == S: if rem_n * R != rem_t: continue else: if C + D < rem_n: continue else: nc = min(C, rem_n) print(a, b, nc, rem_n - nc) exit() elif R < S: if (rem_n * S - rem_t) % (S - R) != 0: continue c = (rem_n * S - rem_t) // (S - R) d = rem_n - c if c >= 0 and c <= C and d >= 0 and d <= D: print(a, b, c, d) exit() else: c = (rem_t - rem_n * S) // (R - S) d = rem_n - c if c >= 0 and c <= C and d >= 0 and d <= D: print(a, b, c, d) exit()