Problem: We have an H \times W grid, where each square is painted white or black in the initial state. Given are strings A_1, A_2, ..., A_H representing the colors of the squares in the initial state. For each pair (i, j) (1 \leq i \leq H, 1 \leq j \leq W), if the j-th character of A_i is `.`, the square at the i-th row and j-th column is painted white; if that character is `#`, that square is painted black.

Among the 2^{HW} ways for each square in the grid to be painted white or black, how many can be obtained from the initial state by performing the operations below any number of times (possibly zero) in any order? Find this count modulo 998,244,353.

* Choose one row, then paint all the squares in that row white.
* Choose one row, then paint all the squares in that row black.
* Choose one column, then paint all the squares in that column white.
* Choose one column, then paint all the squares in that column black.

Constraints

* 1 \leq H, W \leq 10
* |A_i| = W (1 \leq i \leq H)
* All strings A_i consist of `.` and `#`.
* H and W are integers.

Input

Input is given from Standard Input in the following format:


H W
A_1
A_2
\vdots
A_H


Output

Print the answer.

Examples

Input

2 2
#.
.#


Output

15


Input

2 2
.
.#


Output

15


Input

3 3
...
...
...


Output

230


Input

2 4
...
...#


Output

150


Input

6 7
.......
.......
.#.....
..#....
.#.#...
.......


Output

203949910

Solution (in CPP):

Solution:
#include<bits/stdc++.h>
using namespace std;

const int MOD = 998244353;
int upd(int x){return x + (x >> 31 & MOD);}
void inc(int &a , int b){a = upd(a + b - MOD);}
int N , M , vr[13] , vc[13]; char arr[13][13];

int f[1 << 10][1 << 10][3] , g[1 << 10][1 << 10][4][3][4];
bool vf[1 << 10][1 << 10][3] , vg[1 << 10][1 << 10][4][3][4];

int sf(int , int , int);
int sg(int , int , int , int , int);

bool check(int r , int c){
	bool flg = 1;
	for(int i = 0 ; i < N ; ++i) if(r >> i & 1) flg &= (vr[i] & c) != 0 && (vr[i] & c) != c;
	for(int j = 0 ; j < M ; ++j) if(c >> j & 1) flg &= (vc[j] & r) != 0 && (vc[j] & r) != r;
	return flg;
}

int sf(int a , int b , int c){
	if(!a && !b) return 1;
	if(!a || !b) return 0;
	if(vf[a][b][c]) return f[a][b][c];
	vf[a][b][c] = 1; return f[a][b][c] = sg(a , b , 0 , c , 0) + check(a , b);
}

int sg(int a , int b , int c , int d , int e){
	if(c == 4) return e ? sf(a , b , e - 1) : 0;
	if(vg[a][b][c][d][e]) return g[a][b][c][d][e];
	int &t = g[a][b][c][d][e]; vg[a][b][c][d][e] = 1;
	if(c <= 1)
		if(!d) t = sg(a , b , c + 1 , d , e);
		else for(int x = (!c ? a & 31 : a >> 5 << 5) , s = x ; ; s = (s - 1) & x){
				inc(t , sg(a ^ x ^ s , b , c + 1 , d , e | (s != x))); if(!s) break;
			}
	else
		if(d == 1) t = sg(a , b , c + 1 , d , e);
		else
			for(int x = (c == 2 ? b & 31 : b >> 5 << 5) , s = x ; ; s = (s - 1) & x){
				inc(t , sg(a , b ^ x ^ s , c + 1 , d , e | (s != x) << 1)); if(!s) break;
			}
	return t;
}

int main(){
	cin >> N >> M; for(int i = 0 ; i < N ; ++i) for(int j = 0 ; j < M ; ++j) cin >> arr[i][j];
	for(int i = 0 ; i < N ; ++i) for(int j = M - 1 ; ~j ; --j) vr[i] = vr[i] << 1 | (arr[i][j] == '#');
	for(int i = 0 ; i < M ; ++i) for(int j = N - 1 ; ~j ; --j) vc[i] = vc[i] << 1 | (arr[j][i] == '#');
	int sum = 0;
	for(int i = 0 ; i < 1 << N ; ++i) for(int j = 0 ; j < 1 << M ; ++j) inc(sum , sf(i , j , 2));
	cout << sum; return 0;
}