def solve(V,N): W=[V[0],0,0,0] N=min(N,N%4+10**5) for i in range(N): i%=4 j=(i+1)%4 w=min(W[i],V[j]-W[j]) W[i]-=w; W[j]+=w return W V1,V2,V3,V4,N=map(int,input().split()) V=[V1,V2,V3,V4] print(*solve(V,N))