a, b, c, d, n = map(int, input().split()) s = [a, b, c, d] dp = [a, 0, 0, 0] s_0 = [] s_1 = set() j = 0 sw = True while sw: s_0.append(dp.copy()) s_1.add(tuple(dp)) if dp[j % 4] + dp[(j + 1) % 4] <= s[(j + 1) % 4]: dp[j % 4], dp[(j + 1) % 4] = 0, dp[j % 4] + dp[(j + 1) % 4] else: dp[j % 4], dp[(j + 1) % 4] = dp[j % 4] + dp[(j + 1) % 4] - s[(j + 1) % 4], s[(j + 1) % 4] j += 1 if tuple(dp) in s_1: for i in range(len(s_0)): if dp == s_0[i]: loop_dp = dp.copy() loop = 31 loop_T = j - i sw = False if n <= loop: dp = [a, 0, 0, 0] j = 0 while j < n: if dp[j % 4] + dp[(j + 1) % 4] <= s[(j + 1) % 4]: dp[j % 4], dp[(j + 1) % 4] = 0, dp[j % 4] + dp[(j + 1) % 4] else: dp[j % 4], dp[(j + 1) % 4] = dp[j % 4] + dp[(j + 1) % 4] - s[(j + 1) % 4], s[(j + 1) % 4] j += 1 print(*dp) else: m = (n - loop) // loop_T k = n - loop - loop_T * m dp = loop_dp j = 0 while j <= k + 1: if dp[j % 4] + dp[(j + 1) % 4] <= s[(j + 1) % 4]: dp[j % 4], dp[(j + 1) % 4] = 0, dp[j % 4] + dp[(j + 1) % 4] else: dp[j % 4], dp[(j + 1) % 4] = dp[j % 4] + dp[(j + 1) % 4] - s[(j + 1) % 4], s[(j + 1) % 4] j += 1 print(*dp)