using System; using System.Linq; namespace Rotate_and_Sum { class Rotate_and_Sum { static void Main(string[] args) { int[] array = Console.ReadLine().Split().Select(int.Parse).ToArray(); int k = int.Parse(Console.ReadLine()); int[] sumResult = new int[array.Length]; for (int i = 0; i < k; i++) { int last = array.Last(); for (int j = array.Length - 1; j > 0; j--) { array[j] = array[j - 1]; } array[0] = last; for (int m = 0; m < sumResult.Length; m++) { sumResult[m] += array[m]; } } Console.WriteLine(string.Join(" ", sumResult)); } } }