int[] thePlane = Console.ReadLine() .Split() .Select(int.Parse) .ToArray(); int startingPosition = int.Parse(Console.ReadLine()); string comand = Console.ReadLine(); int damage = 1; while (comand!="Supernova") { string[] arr = comand.Split(); string dirction = arr[0]; int step = int.Parse(arr[1]); switch (dirction) { case "left": for (int i = 0; i < step; i++) { startingPosition--; if (startingPosition<0)//-1,ako izlezne ot masiva { startingPosition = thePlane.Length - 1; damage++; } thePlane[startingPosition] -= damage; } break; case "right": for (int i = 0; i < step; i++) { startingPosition++; if (startingPosition>thePlane.Length-1) { startingPosition = 0; damage++; } thePlane[startingPosition] -= damage; } break; } comand = Console.ReadLine(); } Console.WriteLine(string.Join(" ",thePlane));