#include using namespace std; using Int = long long; template inline bool setmin(T &A, T B){ if (A > B){ A = B; return true; } else { return false; } } template inline bool setmax(T &A, T B){ if (A < B){ A = B; return true; } else { return false; } } #define REP(x, y) for (int x = 0; x < int(y); ++x) #define rep(x, y, z) for (int x = int(y); x < int(z); ++x) #define PER(x, y) for (int x = int(y) - 1; x >= 0; --x) #define per(x, y, z) for (int x = int(z) - 1; x >= int(y); --x) short ff[200200200]; void solve(){ int A, B, C, D, N; cin >> A >> B >> C >> D >> N; int P, Q, R, S, T; cin >> P >> Q >> R >> S >> T; REP(i, min(N + 1, A + B + 1)){ if (N - i <= C + D){ REP(j, min(i + 1, A + 1)){ if (i - j <= B){ int x = P * j + Q * (i - j); ff[x] = j + 1; } } REP(j, min(N - i + 1, C + 1)){ if (N - i - j <= D){ int x = T - R * j - S * (N - i - j); if (x >= 0 && ff[x]){ cout << ff[x] - 1 << ' ' << i - (ff[x] - 1) << ' ' << j << ' ' << N - i - j << '\n'; return; } } } REP(j, min(i + 1, A + 1)){ if (i - j <= B){ int x = P * j + Q * (i - j); ff[x] = 0; } } } } } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int t = 1; // cin >> t; while (t--){ solve(); } }