V1, V2, V3, V4, N = map(int, input().split()) V = [V1, V2, V3, V4] now = [V1, 0, 0, 0] s = {tuple(now)} for i in range(N): if now[i%4]+now[(i+1)%4]<=V[(i+1)%4]: now[i%4], now[(i+1)%4] = 0, now[i%4]+now[(i+1)%4] else: now[i%4], now[(i+1)%4] = now[i%4]-V[(i+1)%4]+now[(i+1)%4], V[(i+1)%4] if i%4==3: if tuple(now) in s: for j in range(N%(i+1)): if now[j%4]+now[(j+1)%4]<=V[(j+1)%4]: now[j%4], now[(j+1)%4] = 0, now[j%4]+now[(j+1)%4] else: now[j%4], now[(j+1)%4] = now[j%4]-V[(j+1)%4]+now[(j+1)%4], V[(j+1)%4] exit(print(*now)) s.add(tuple(now)) print(*now)