#include #define rep(i,n) for (int i = 0; i < int(n); ++i) using namespace std; templateistream &operator>>(istream &is,vector &v){for(auto &e:v)is>>e;return is;} templateostream &operator<<(ostream &os,const vector &v){if(v.size()!=0){rep(i,v.size())os<void o(T a){cout< v(4); cin >> v; vector a(4,0); a[0] = v[0]; int n; cin >> n; auto f = [&](int x){ int y = (x + 1) % 4; int w = min(a[x],v[y]-a[y]); a[x] -= w; a[y] += w; }; rep(i,n) f(i%4); o(a); }