#include #include #include #include #include using namespace std; // using namespace atcoder; typedef long long ll; typedef long double ld; const ll INF = 1LL << 60; const ll MOD = 998244353; // using mint = modint998244353; const string NEW_LINE = "\n"; inline void output_YesNo(bool x) { cout << (x ? "Yes" : "No") << endl; } template inline void chmax(T &lhs, const T &rhs) { lhs = max(lhs, rhs); } template inline void chmin(T &lhs, const T &rhs) { lhs = min(lhs, rhs); } // #include // // void init_output() { cout << fixed << setprecision(15); } int main() { vector v(4); for (auto &x: v)cin >> x; ll n; cin >> n; vector now(4); now[0] = v[0]; for (ll i = 0; i < n / 4; i++) { vector next = now; for (int j = 0; j < 4; j++) { int move = min(next[j], v[(j + 1) % 4] - next[(j + 1) % 4]); next[j] -= move, next[(j + 1) % 4] += move; } if (now == next)break; now = next; } { vector next = now; for (int j = 0; j < n % 4; j++) { int move = min(next[j], v[(j + 1) % 4] - next[(j + 1) % 4]); next[j] -= move, next[(j + 1) % 4] += move; } now = next; } for (int i = 0; i < 4; i++) { if (i > 0)cout << " "; cout << now[i]; } cout << endl; return 0; }