#MINES4. Four Mines
Four Mines
A Company that Makes Everything (ACME) has entered the surface mining business. They bought a rectangular field which is split into cells, with each cell having a profit value. A mine is a non-empty rectangular region, and the profit of a mine is equal to the sum of the values of all its cells. ACME wants to extract ore from four different non-overlapping mines. You are to choose these mines to maximize the total profit.
Input
The first line contains an integer T (1 ≤ T ≤ 5), denoting the number of test cases.
For each test case, the first line contains two positive integers R and C (2 ≤ R, C ≤ 100), denoting the number of rows and columns of a rectangular field.
Each of next R lines contain C integers between -10000 and 10000, denoting a profit value for each cell in that row.
Output
For each test case, print a number on its own line, denoting the maximum total profit that can be extracted from four mines.
Example
Input: 2 5 5 10 10 -1 -1 10 10 -1 -1 -1 10 -1 -1 -1 -1 -1 -1 -1 -1 10 10 10 -1 -1 10 10 2 3 -1 -2 -3 -4 -5 66</p>Output: 99 60