#P6323. Problem E. Find The Submatrix

Problem E. Find The Submatrix

Problem Description

Little Q is searching for the submatrix with maximum sum in a matrix of $n$ rows and $m$ columns. The standard algorithm is too hard for him to understand, so he (and you) only considers those submatrixes with exactly $m$ columns.
It is much easier now. But Little Q always thinks the answer is too small. So he decides to reset no more than $A$ cells' value to $0$, and choose no more than $B$ disjoint submatrixes to achieve the maximum sum. Two submatrix are considered disjoint only if they do not share any common cell.
Please write a program to help Little Q find the maximum sum. Note that he can choose nothing so the answer is always non-negative.

Input

The first line of the input contains an integer $T(1\leq T\leq10)$, denoting the number of test cases.
In each test case, there are $4$ integers $n,m,A,B(1\leq n\leq 100,1\leq m\leq 3000,0\leq A\leq 10000,1\leq B\leq 3)$.
Each of the following $n$ lines contains $m$ integers, the $j$-th number on the $i$-th of these lines is $w_{i,j}(|w_{i,j}|\leq 10^9)$, denoting the value of each cell.

Output

For each test case, print a single line containing an integer, denoting the maximum sum.

2 5 1 0 1 3 -1 5 -1 -2 5 1 1 1 3 -1 5 -1 -2
7 8