Anina is a girl who is very much interested in mathematics. She likes to solve Geometry and Counting problems very much. Today is Anina's birthday. Her parents got her a birthday cake of size $n * m$ unit area. If we consider the cake as a $n * m$ size grid then some of the cell contains strawberry and some of the cell doesn’t.
Anina likes to eat strawberries very much. So she wants to have that portion of cake which is full of strawberries and has a square shape. In the above picture $1$means the cell contains a strawberry and $0$ means doesn’t.
As a friend of Anina I want to give her a counting problem for her birthday. The problem is how many ways Anina can cut a portion from the cake according to her preference ? But to cross check Anina’s reply I need to know the exact answer. Can you please solve this problem for me ?
The first line of each test case contains two integers n and m $(1≤n,m≤11)$ — the number of rows and columns, respectively.
The following $n$ lines contain $m$ integers each, the $j$ -th element in the $i$-th line is either$0$or $1$ which indicates that there is a strawberry or not.
Print the answer for the mentioned problem.
Input | Output |
---|---|
4 5 1 0 0 0 0 0 1 1 1 0 0 0 1 1 1 0 1 1 1 0 | 12 |