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>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
#define debug puts("wzpakking")
#define y1 ysghysgsygsh
using namespace std;
const int mo=998244353;
const int N=25;
char s[N][N];
int n,m,ans;
int C[N][N],P[N];
int f[N][N],g[N][N];
int ok1[1<<10][N];
int ok2[1<<10][N];
void init(){
	P[0]=1;
	For(i,1,N-1) P[i]=2*P[i-1];
	For(i,0,N-1) C[i][0]=1;
	For(i,1,N-1) For(j,1,i)
		C[i][j]=C[i-1][j]+C[i-1][j-1];
}
int main(){
	init();
	scanf("%d%d",&n,&m);
	For(i,1,n) scanf("%s",s[i]+1);
	f[0][0]=1;
	For(S,0,2*N-2) For(i,0,N-1) if (S>=i&&S-i<=N-1)
		For(k,1,N-1-(S-i)) f[S-i+k][i]=(f[S-i+k][i]+1ll*f[i][S-i]*C[S-i+k][k])%mo;
	For(i,0,N-1) For(j,0,i) f[i][j]=f[j][i]=(f[i][j]+f[j][i])%mo;
	f[0][0]=1;
	For(i,1,n) For(j,1,m) For(x,0,i) For(y,0,j)
		g[i][j]=(g[i][j]+1ll*C[i][x]*C[j][y]%mo*f[x][j-y]%mo*f[i-x][y])%mo;
	For(i,0,(1<<n)-1) For(j,1,m){
		int cnt=0,S=0;
		For(k,1,n) if (i&(1<<(k-1)))
			cnt+=(s[k][j]=='#'),S++;
		ok1[i][j]=(cnt&&cnt!=S);
	}
	For(i,0,(1<<m)-1) For(j,1,n){
		int cnt=0,S=0;
		For(k,1,m) if (i&(1<<(k-1)))
			cnt+=(s[j][k]=='#'),S++;
		ok2[i][j]=(cnt&&cnt!=S);
	}
	For(i,1,(1<<n)-1) For(j,1,(1<<m)-1){
		bool fl=1;
		For(k,1,m) if (j&(1<<(k-1))) fl&=ok1[i][k];
		For(k,1,n) if (i&(1<<(k-1))) fl&=ok2[j][k];
		if (!fl||!(i+j)) continue;
		int S1=n,S2=m;
		//cout<<i<<' '<<j<<endl;
		For(k,1,m) if (j&(1<<(k-1))) S2--;
		For(k,1,n) if (i&(1<<(k-1))) S1--;
		if (!S1&&!S2) ans=(ans+1)%mo;
		else if (!S1||!S2) ans=(ans+P[S1+S2])%mo;
		else ans=(ans+g[S1][S2])%mo;
	}
	//cout<<f[n][m]<<endl;
	ans=(ans+f[n][m])%mo;
	printf("%d\n",ans);
}