A,B,C,D,N=map(int,input().split()) V=[A,B,C,D] S=set() D=dict() X=[-1] Y=[] def f(a,b,c,d): v=min(a+b,d) w=v-b return (a-w,v) def dfs(x): if x in S: return D[x] D[x]=len(S) S.add(x) Y.append(x) i=x[4] y=[x[0],x[1],x[2],x[3],(i+1)&3] y[i],y[(i+1)&3]=f(y[i],y[(i+1)&3],V[i],V[(i+1)&3]) y=tuple(y) v=len(S)-1 X.append(-1) X[v]=dfs(y) return v dfs((A,0,0,0,0)) del X[-1] M=N N=len(X) P=[[-1]*N for i in range(62)] for i in range(N): P[0][i]=X[i] for i in range(61): for j in range(N): P[i+1][j]=P[i][P[i][j]] v=0 for i in range(62): if (M>>i)&1: v=P[i][v] print(*Y[v][:4])