#include using namespace std; using ll = unsigned long long; int main(){ vector v(4); vector h(4,0); for(int i = 0;i < 4;++i){ cin >> v[i]; } h[0] = 1LL; h[1] = 10000LL; h[2] = 100000000LL; h[3] = 1000000000000LL; ll n; cin >> n; ll cnt = 0; vector mizu(4); ll now = 0; std::unordered_map pl; mizu[0] = v[0]; pl[v[0]] = 0; bool first = false; while(n > 0){ ++cnt; --n; ll ryo = min(mizu[now], v[(now+1)%4]-mizu[(now+1)%4]); mizu[now] -= ryo; mizu[(now+1)%4] += ryo; ll nxt = mizu[0]*h[0] + mizu[1]*h[1] + mizu[2]*h[2] + mizu[3]*h[3]; if(pl.count(nxt) >= 1 && first == false){ ll pre = pl[nxt]; ll kaisu = cnt - pre; ll tmp = n/kaisu; n -= (kaisu*tmp); first = true; } now = (now+1)%4; pl[nxt] = cnt; } for(int i = 0;i < 4;++i){ cout << mizu[i] << ' '; } cout << endl; }