#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], ss[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; vector> X; X.reserve((A + B + 1) * (A + 1)); REP(i, min(N + 1, A + B + 1)){ REP(j, min(i + 1, A + 1)){ if (i - j <= B){ X.push_back({i, P * j + Q * (i - j), j, i - j}); } } } vector> Y; Y.reserve((C + D + 1) * (C + 1)); PER(i, min(N + 1, C + D + 1)){ REP(j, min(i + 1, C + 1)){ if (i - j <= D){ Y.push_back({i, R * j + S * (i - j), j, i - j}); } } } int l = 0; vector q; q.reserve(Y.size()); int j = 0; REP(i, X.size()){ if (i == 0 || get<0>(X[i]) != get<0>(X[i - 1])){ while (l < int(q.size())){ ff[q[l]] = 0; ss[q[l]] = 0; ++l; } while (j < int(Y.size()) && N - get<0>(X[i]) <= get<0>(Y[j])){ if (N - get<0>(X[i]) == get<0>(Y[j])){ ff[get<1>(Y[j])] = get<2>(Y[j]) + 1; ss[get<1>(Y[j])] = get<3>(Y[j]) + 1; q.push_back(get<1>(Y[j])); } ++j; } } if (ff[T - get<1>(X[i])] > 0){ cout << get<2>(X[i]) << ' ' << get<3>(X[i]) << ' ' << ff[T - get<1>(X[i])] - 1 << ' ' << ss[T - get<1>(X[i])] - 1 << '\n'; return; } } } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int t = 1; // cin >> t; while (t--){ solve(); } }