#include <bits/stdc++.h> using namespace std; int main(){ int A, B, C, D, N; cin >> A >> B >> C >> D >> N; int P, Q, R, S, T; cin >> P >> Q >> R >> S >> T; for (int i = 0; i <= A; i++){ for (int j = 0; j <= B; j++){ int n = N - i - j, t = T - P * i - Q * j; if (n >= 0 && t >= 0){ if (R == S){ if (t == R * n){ if (n <= C){ cout << i << ' ' << j << ' ' << n << ' ' << 0 << endl; return 0; } else if (n <= C + D){ cout << i << ' ' << j << ' ' << C << ' ' << n - C << endl; return 0; } } } else { if ((n * S - t) % (S - R) == 0 && (t - n * R) % (S - R) == 0){ int x = (n * S - t) / (S - R); int y = (t - n * R) / (S - R); if (0 <= x && x <= C && 0 <= y && y <= D){ cout << i << ' ' << j << ' ' << x << ' ' << y << endl; return 0; } } } } } } }