#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=998244353,MAX=300005;
const ll INF=1LL<<60;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    vector<int> V(4);
    for(int i=0;i<4;i++) cin>>V[i];
    ll N;cin>>N;
    map<vector<int>,int> MA;
    vector<int> now(4);now[0]=V[0];
    MA[now]=0;
    int syuu=-1;
    for(int t=4;;t+=4){
        for(int i=0;i<4;i++){
            int x=min(now[i],V[(i+1)%4]-now[(i+1)%4]);
            now[i]-=x;
            now[(i+1)%4]+=x;
        }
        if(MA.count(now)){
            syuu=t-MA[now];
            break;
        }else{
            MA[now]=t;
        }
    }
    
    ll can=N/syuu-2;
    chmax(can,0LL);
    N-=can*syuu;
    
    for(ll t=0;t<N;t++){
        int x=min(now[t%4],V[(t+1)%4]-now[(t+1)%4]);
        now[t%4]-=x;
        now[(t+1)%4]+=x;
    }
    
    for(int i=0;i<4;i++){
        cout<<now[i]<<" ";
    }
    cout<<endl;
}