After getting placed at Microsoft, Akshit has loads of free time and no work.
So he decided to re-live his childhood days. He brought an old school maths notebook and a ben 10 pencil to draw a sketch.
Being noob and lazy in everything he does, he ended up scribbling on the notebook, without even lifting his pencil.
( No diagonal movement )

Now considering the scribbled boxes, you have to find the perimeter of the figure drawn.

Input
First line contains T denoting the number of test cases.
Each of the test cases starts with two integers R , C denoting the number of rows and columns in the page.
Then R lines denoting the state of the page.

Output
A single Integer for each test case denoting the perimeter of the figure.

Constraints
1 < = T < = 20
1 < = R ,C < = 25

Sample Input
2

3 3
0 0 0
0 1 0
0 0 0

4 4
0 0 0 0
0 1 1 1
0 0 0 1
0 0 0 1
Sample Output
4
12

Problem Setter : Sunny Lalwani
Problem Source: Directi Coding Round

Languages: Brain,C,C++,Java,C#,JavaScript,Perl,PHP,Pascal,Python,Ruby,Text

Time Limit: 1 Second(s)
Score: 100 Point(s)
Input File Limit: 50000 Bytes

Mode Judge

RankNameScore
1xyz0
2Ams0
3TIP0
4team420
5xyzz0
6asdasdasd0
7abcd0
8khankhan0
9Gabriel0
10gigel0