#include using namespace std; #define int long long signed main() { vector c(4); for (int &x : c) cin >> x; int n; cin >> n; vector a(4); a[0] = c[0]; if (n >= 396) n = n % 4 + 396; for (int i = 0; i < n; i ++) { int j = (i + 1) % 4; int x = min(a[i % 4], c[j] - a[j]); a[j] += x; a[i % 4] -= x; } for (int x : a) cout << x << ' '; cout << '\n'; return 0; }