You’re given a multi-layered rack in the form of a matrix with m rows and n columns. Each cell is occupied either by a red pill (marked by r), a blue pill (marked by b) or a germ (marked by x). A red pill can kill adjacent germs (if any) in horizontal, vertical and diagonal directions whereas a blue pill can kill adjacent germs (if any) in horizontal and vertical direction only. Initially the pills are inactive. Once active, they can act on adjacent germs. You need to find the count of the remaining germs in the rack once the pills are activated.
Input Format
The first line contains a single integer t, denoting the number of test cases.
The first line of each test case contains two spare separated integers m and n denoting the number of rows and number of columns in the matrix respectively. Following m lines each contains n elements.
Output Format
For each test case print the count of remaining germs.
Constraints
1 <= t <= 1000
1 <= m <= 100
1 <= n <= 100
Sample Input
4
2 2
bx
xx
2 2
rb
br
2 2
xx
xx
1 5
xxbxx
Sample Output
1
0
4
2