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 N=11,mo=998244353;
char s[N][N];
int inv[N],fac[N],f[N][N],g[N][N],w[N],v[N];
//f[i][j] indicate the number of ways that print a i*j rectangle
//g[i][j] indicate the number of ways that print a i*j L 
void init(){
	fac[0]=inv[0]=fac[1]=inv[1]=1;
	for(int i=2;i<=10;i++)fac[i]=fac[i-1]*i,inv[i]=1ll*(mo-mo/i)*inv[mo%i]%mo;
	for(int i=2;i<=10;i++)inv[i]=1ll*inv[i]*inv[i-1]%mo;
}
void add(int &x,int y){(x+=y)%=mo;}
int mul(int x){return x;}
template<class... T> int mul(int x,T... y){return 1ll*x*mul(y...)%mo;}
inline int C(int n,int m){return 1ll*fac[n]*inv[n-m]%mo*inv[m]%mo;}
int main(){
	init();
	int n,m,s1,s2;scanf("%d%d",&n,&m),s1=(1<<n),s2=(1<<m);
	for(int i=0;i<n;i++){
		scanf("%s",s[i]);
		for(int j=0;j<m;j++)if(s[i][j]=='#')w[i]|=(1<<j),v[j]|=(1<<i);
	}
	for(int i=0;i<=n;i++){
		for(int j=0;j<=m;j++){
			if(!i||!j){f[i][j]=1,g[i][j]=1<<(i+j);continue;}
			for(int k=1;k<=i;k++)add(f[i][j],mul(k&1?1:mo-1,C(i,k),1<<k,f[i-k][j])),
			add(g[i][j],mul(k&1?1:mo-1,C(i,k),1<<k,g[i-k][j]));
			for(int k=1;k<=j;k++)add(f[i][j],mul(k&1?1:mo-1,C(j,k),1<<k,f[i][j-k])),
			add(g[i][j],mul(k&1?1:mo-1,C(j,k),1<<k,g[i][j-k]));
			for(int k=1;k<=i;k++)for(int l=1;l<=j;l++){
				add(f[i][j],mul((k+l)&1?1:mo-1,C(i,k),C(j,l),2,f[i-k][j-l]));
				add(g[i][j],mul((k+l)&1?1:mo-1,C(i,k),C(j,l),2,g[i-k][j-l]));
			}
		}
	}
	int ans=0;
	for(int i=1;i<s1;i++){
		for(int j=1;j<s2;j++){
			bool fl=0;int a=0,b=0;
			for(int k=0;k<n;k++)if(i&(1<<k))a++,fl|=(w[k]&j)==j||((~w[k])&j)==j;
			for(int k=0;k<m;k++)if(j&(1<<k))b++,fl|=(v[k]&i)==i||((~v[k])&i)==i;
			if(!fl)add(ans,g[n-a][m-b]);
		}
	}
	printf("%d",(ans+f[n][m])%mo);
	return 0;
}