using System;
public class Program
{
public static void Main()
int[] nums = new int[] { 7, -9, 2, 7, 4, -3, 1, -2, -7, 6, 9, 3, -9, -3, 4, -5, -10, 8, -5, 9, 9, -5, 9, 4, -5, 6, 5, -2, -2, -4, 8, -6, -10, 10, -1, -5, -10, 7, -7, 1, 4, -5, -4, 7, 4, 4, 5, 10, 1, -3 };
int current = nums[0], max = nums[0];
int startIndex = 0, endIndex = 0;
string maxArray = "";
for(int i = 1; i < nums.Length; i++)
if(current + nums[i] > nums[i])
current += nums[i];
}
else
current = nums[i];
startIndex = i;
if(max < current)
max = current;
endIndex = i;
for(; startIndex <= endIndex ; startIndex++)
maxArray += nums[startIndex].ToString();
if(startIndex != endIndex)
maxArray += ",";
Console.WriteLine(max);
Console.WriteLine(maxArray);