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 unit area. If we consider the cake as a 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 means the cell contains a strawberry and 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 — the number of rows and columns, respectively.
The following lines contain integers each, the -th element in the -th line is eitheror 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 |