import sys input = lambda :sys.stdin.readline()[:-1] ni = lambda :int(input()) na = lambda :list(map(int,input().split())) yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES") no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO") ####################################################################### a,b,c,d,n = na() n = min(n % 4 + 1000000, n) v = [a,b,c,d] w = [a,0,0,0] m = 4 for j in range(n): x = min(w[j%4],v[(j+1)%4]-w[(j+1)%4]) w[j%4] -= x w[(j+1)%4] += x #print(*w) if j % 4 == 3: print() print(*w)