# Lazy N00B

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.

1 = shaded box

0 = unshaded box

**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 Tester : Shikhar Sharad*

*Problem Source: Directi Coding Round*

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