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;

typedef long long LL;
#define N 12

const LL mod=998244353;
LL n,m,p,ans,a[N][N],f[N][N][3],g[N][N][3],row[N],col[N],C[N][N];
char s[N];

void upd(LL &x,LL y){x=(x+y)%mod;}

bool pd(LL i,LL j){
	if (i==0||j==0) return 1;
	for (LL k=0;k<n;++k)
		if ((i>>k&1)&&((row[k]&j)==j||(row[k]&j)==0)) return 0;
	for (LL k=0;k<m;++k)
		if ((j>>k&1)&&((col[k]&i)==i||(col[k]&i)==0)) return 0;
	return 1;
}

LL pw(LL x,LL k){
	return x==1?1:1<<k;
}

int main(){
	scanf("%lld%lld",&n,&m);
	for (LL i=1;i<=n;++i){
		scanf("%s",s+1);
		for (LL j=1;j<=m;++j) a[i-1][j-1]=s[j]=='.';
	}
	for (LL i=0;i<n;++i){
		for (LL j=0;j<m;++j) row[i]|=a[i][j]<<j;
	}
	for (LL i=0;i<m;++i){
		for (LL j=0;j<n;++j) col[i]|=a[j][i]<<j;
	}
	p=max(n,m);
	for (LL i=0;i<=p;++i){
		C[i][0]=1;
		for (LL j=1;j<=i;++j) C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;
	}
	for (LL i=n;i;--i)
		f[i][m][2]=1<<(n-i);
	f[0][m][0]=1<<n;
	for (LL i=n;i;--i)
		for (LL j=m;j;--j){
			for (LL k=1;k<j;++k){
				upd(g[i][j-k][2],f[i][j][2]*((1<<k)-2)%mod*C[m-j+k][k]);
				upd(g[i][j-k][1],(f[i][j][2]*2+f[i][j][1])%mod*C[m-j+k][k]);
			}
			upd(g[i][0][0],f[i][j][2]*((1<<j)-2)%mod*C[m][j]);
			for (LL k=1;k<i;++k){
				upd(f[i-k][j][2],g[i][j][2]*((1<<k)-2)%mod*C[n-i+k][k]);
				upd(f[i-k][j][1],(g[i][j][2]*2+g[i][j][1])%mod*C[n-i+k][k]);
			}
			upd(f[0][j][0],g[i][j][2]*((1<<i)-2)%mod*C[n][i]);
		}			
	for (LL i=0;i<1<<n;++i)
		for (LL j=0;j<1<<m;++j){
			LL ii=0,jj=0;
			for (LL k=0;k<n;++k) ii+=i>>k&1;
			for (LL k=0;k<m;++k) jj+=j>>k&1;
			if (pd(i,j))
				for (LL k=0;k<=2;++k) upd(ans,f[ii][jj][k]+g[ii][jj][k]);
		}
	printf("%lld\n",(ans+mod)%mod);
	
	return 0;
}