Problem: Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an matrix consisting of "*" and ".".
To find every spruce first let's define what a spruce in the matrix is. A set of matrix cells is called a spruce of height with origin at point if:
- All cells in the set contain an "*".
- For each all cells with the row number and columns in range must be a part of the set. All other cells cannot belong to the set.
Examples of correct and incorrect spruce trees:
Now Rick wants to know how many spruces his matrix contains. Help Rick solve this problem.
Input Format: Each test contains one or more test cases. The first line contains the number of test cases ().
The first line of each test case contains two integers and () — matrix size.
Next lines of each test case contain characters — matrix contents. It is guaranteed that is either a "." or an "*".
It is guaranteed that the sum of over all test cases does not exceed ().
Output Format: For each test case, print single integer — the total number of spruces in the matrix.
Note: In the first test case the first spruce of height has its origin at point , the second spruce of height has its origin at point , the third spruce of height has its origin at point , the fourth spruce of height has its origin at point , the fifth spruce of height has its origin at point .
In the second test case the first spruce of height has its origin at point , the second spruce of height has its origin at point , the third spruce of height has its origin at point .