using System.Xml.Serialization;
using System.Collections;
using System.Collections.Generic;
public static void Main()
int[,] numbers = new int[3,5]
var row_sum = numbers.Cast<int>()
.Select((x, i) => new { Index = i, Value = x })
.GroupBy(x => x.Index / (numbers.GetUpperBound(1) +1))
.Select(x => x.OrderBy(c=>c.Value).Skip(1).Take(numbers.GetUpperBound(1)-1).Sum(c=>c.Value))
int[][] numbers2 = new int[][]
new int[] {1, 4,5,6, 10},
new int[] {1,-2,3, 10, 1, },
new int[] {-7,-8,-9, -1, 0}
var sum_array =numbers2.Select(x => x.OrderBy(c=>c)