import sys input = lambda: sys.stdin.readline().rstrip() ################## v1, v2, v3, v4, n = map(int, input().split()) st = set((v1, 0, 0, 0, 0)) now = [v1, 0, 0, 0, 0] li = [tuple(now)] for i in range(n): if i % 4 == 0: delta = min(now[0], v2-now[1]) now[0] -= delta now[1] += delta if i % 4 == 1: delta = min(now[1], v3-now[2]) now[1] -= delta now[2] += delta if i % 4 == 2: delta = min(now[2], v4-now[3]) now[2] -= delta now[3] += delta if i % 4 == 3: delta = min(now[3], v1-now[0]) now[3] -= delta now[0] += delta now[4] += 1 now[4] %= 4 t = tuple(now) if t in st: period_t = tuple(now) break st.add(tuple(now)) li.append(tuple(now)) else: print(*now) exit() indx = li.index(period_t) P = li[indx:] print(*P[(n-indx) % len(P)][:-1])