BETA

#### Submissions: 543 Accuracy: 31.12%

Maximum sum of hour glass

Given a 2D matrix, the task is to find maximum sum of a hour glass.

```An hour glass is made of 7 cells
in following form.
A B C
D
E F G
```

Examples:

```Input : 1 1 1 0 0
0 1 0 0 0
1 1 3 0 0
0 0 0 2 0
0 0 0 0 4
Output : 9
Below is the hour glass with
maximum sum:
3 0 0
2
0 0 4

```

Input:
The first line of input contains an integer T denoting the no of test cases. Then T test cases follow. Each test case contains two space separated integers N and M denoting the size of the matrix. Then in the next line are N*M values of the matrix (m).

Output:
For each test case in a new line print the required output.

Constraints:
1<=T<=100
1<=N,M<=20
1<=m[][]<1000

Example:
Input:

2
1 2
1 2
3 3
1 1 1 1 1 1 1 1 1

Output:
-1
7

#### ** For More Input/Output Examples Use 'Expected Output' option **

##### It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.