import sys input = lambda: sys.stdin.readline().rstrip() ii = lambda: int(input()) mi = lambda: map(int, input().split()) li = lambda: list(mi()) INF = 2 ** 63 - 1 mod = 998244353 v = li() n = v.pop() a = [0] * 4 a[0] = v[0] for i in range(min(n, 4 * 10 ** 6 + n % 4)): temp = min(a[i % 4], v[(i + 1) % 4] - a[(i + 1) % 4]) a[i % 4] -= temp a[(i + 1) % 4] += temp print(*a)