UOJ Logo 黑暗爆炸OJ

DARKBZOJ

#3336. Uva10572 Black and White

Statistics 下载数据

Description

Input

The first line in the input contains an integer T (less than 100), the number of cases to follow. Each case starts with two integers, M and N (2 ≤ M, N ≤ 8), the number of rows and columns respectively in the grid. The next M lines contains N characters each and describes the grid using the following characters:

# - a cell which is colored black
o - a cell which is colored white
. - a cell which color has not yet been assigned

Output

每组测试数据,输出一个数,表示方案总数

Sample Input

1(1组输入)
2 3(m=2,n=3)
.o.
.#.

Hint
.表示未着色
#表示黑色
o表示白色
每组测试数据间用一个空行隔开


Sample Output

9

Hint

Source