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 = i loop_T = j - i sw = False if n <= 100000: 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_0 = loop_dp j = loop while j < loop + k: if dp_0[j % 4] + dp_0[(j + 1) % 4] <= s[(j + 1) % 4]: dp_0[j % 4], dp_0[(j + 1) % 4] = 0, dp_0[j % 4] + dp_0[(j + 1) % 4] else: dp_0[j % 4], dp_0[(j + 1) % 4] = dp_0[j % 4] + dp_0[(j + 1) % 4] - s[(j + 1) % 4], s[(j + 1) % 4] j += 1 print(*dp_0)