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<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int mod=998244353;
#define N 23
inline int read(){
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9'){
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
	return x*f;
}
#define ck(x) (x>=mod?(x)-mod:x)
int n,m,f[N][N][3],g[N][N][3],ans,c[N],r[N],cnt[1<<10];
int pw2[N],C[N][N];
char mp[N][N];
int qpow(int a,int b){
	int ans=1;
	while(b){
		if(b&1)ans=1LL*ans*a%mod;
		a=1LL*a*a%mod;
		b>>=1;
	}
	return ans;
}
int Inv(int x){
	return qpow(x,mod-2);
}
void init(int n){
	pw2[0]=C[0][0]=1;
	for(int i=1;i<=n;++i){
		pw2[i]=ck(pw2[i-1]<<1);
		C[i][0]=1;
		for(int j=1;j<=i;++j){
			C[i][j]=ck(C[i-1][j-1]+C[i-1][j]);
		}
	}
	for(int i=1;i<(1<<n);++i){
		cnt[i]=cnt[i>>1]+(i&1);
	}
}
int Solve(int x,int y){
	for(int i=1;i<=n;++i){
		if((x>>i-1)&1){
			if((r[i]&y)==0||(r[i]&y)==y)return 0;
		}
	}
	for(int j=1;j<=m;++j){
		if((y>>j-1)&1){
			if((c[j]&x)==0||(c[j]&x)==x)return 0;
		}
	}
	return 1LL*ck(f[cnt[x]][cnt[y]][0]+g[cnt[x]][cnt[y]][0])*Inv(C[n][cnt[x]])%mod*Inv(C[m][cnt[y]])%mod;
}
int main(){
	n=read(),m=read();
	for(int i=1;i<=n;++i){
		scanf("%s",mp[i]+1);
		for(int j=1;j<=m;++j){
			r[i]|=((mp[i][j]=='#')<<j-1);
			c[j]|=((mp[i][j]=='#')<<i-1);
		}
	}
	init(max(n,m));
	for(int j=1;j<=m;++j){
		g[n][j][2]=1LL*C[m][j]*pw2[m-j]%mod;
	}
	ans+=pw2[m];
	for(int i=n;i>=1;--i){
		for(int j=m;j>=1;--j){
			for(int k=1;k<i;++k){
				int t=i-k;
				f[k][j][1]=(f[k][j][1]+(2LL*g[i][j][2]+g[i][j][1])*C[i][t])%mod;
				f[k][j][2]=(f[k][j][2]+1LL*g[i][j][2]*(pw2[t]-2)%mod*C[i][t])%mod;
			}
			for(int k=1;k<j;++k){
				int t=j-k;
				g[i][k][1]=(g[i][k][1]+(2LL*f[i][j][2]+f[i][j][1])*C[j][t])%mod;
				g[i][k][2]=(g[i][k][2]+1LL*f[i][j][2]*(pw2[t]-2)%mod*C[j][t])%mod;
			}
			f[i][j][0]=ck(f[i][j][1]+f[i][j][2]);
			g[i][j][0]=ck(g[i][j][1]+g[i][j][2]);
			ans=(ans+1LL*f[i][j][2]*(pw2[j]-2)+1LL*g[i][j][2]*(pw2[i]-2))%mod;
		}
	}
	for(int i=1;i<(1<<n);++i){
		for(int j=1;j<(1<<m);++j){
			ans=(ans+Solve(i,j))%mod;
		}
	}
	printf("%d\n",ans);
	return 0;
}