#include using namespace std; int main() { vector V(4); long long N; for (int i = 0; i < 4; i++) { cin >> V[i]; } cin >> N; vector ans(4, 0); if (N < 4) { ans[0] = V[0]; for (int i = 0; i < N; i++) { int w = min(ans[i], V[i + 1]); ans[i] -= w; ans[i + 1] += w; } } else { int idx = 0; int t = 100; for (int i = 0; i < 4; i++) { if (t >= V[i]) { idx = i; t = V[i]; } } int v = V[0] - t; for (int i = idx; i >= 0; i--) { if (v - (V[i] - t) >= 0) { ans[i] += V[i] - t; v -= V[i] - t; } else { ans[i] += v; break; } } N %= 4; ans[N] += t; } for (int i = 0; i < 4; i++) { cout << ans[i]; if (i == 3) { cout << endl; } else { cout << " "; } } }