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 clr(x) memset(x,0,sizeof (x))
#define For(i,a,b) for (int i=(a);i<=(b);i++)
#define Fod(i,b,a) for (int i=(b);i>=(a);i--)
#define fi first
#define se second
#define kill _z_kill
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define outval(x) cerr<<#x" = "<<x<<endl
#define outv(x) cerr<<#x" = "<<x<<"  "
#define outtag(x) cerr<<"--------------"#x"---------------"<<endl
#define outarr(a,L,R) cerr<<#a"["<<L<<".."<<R<<"] = ";\
	For(_x,L,R) cerr<<a[_x]<<" ";cerr<<endl;
#define User_Time ((double)clock()/CLOCKS_PER_SEC)
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned uint;
typedef long double LD;
typedef vector <int> vi;
typedef pair <int,int> pii;
LL read(){
	LL x=0,f=0;
	char ch=getchar();
	while (!isdigit(ch))
		f=ch=='-',ch=getchar();
	while (isdigit(ch))
		x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return f?-x:x;
}
const int mod=998244353;
int Pow(int x,int y){
	int ans=1;
	for (;y;y>>=1,x=(LL)x*x%mod)
		if (y&1)
			ans=(LL)ans*x%mod;
	return ans;
}
void Add(int &x,int y){
	if ((x+=y)>=mod)
		x-=mod;
}
void Del(int &x,int y){
	if ((x-=y)<0)
		x+=mod;
}
int Add(int x){
	return x>=mod?x-mod:x;
}
int Del(int x){
	return x<0?x+mod:x;
}
void ckmax(int &x,int y){
	if (x<y)
		x=y;
}
void ckmin(int &x,int y){
	if (x>y)
		x=y;
}
const int N=15;
int n,m,nm;
int v[N][N];
int C[N][N],invC[N][N];
void prework(){
	For(i,0,nm){
		C[i][0]=invC[i][0]=1;
		For(j,1,i){
			C[i][j]=C[i-1][j-1]+C[i-1][j];
			invC[i][j]=Pow(C[i][j],mod-2);
		}
	}
}
int f[N][N][3],g[N][N][3];
int res[N][N];
int main(){
	n=read(),m=read(),nm=max(n,m);
	For(i,0,n-1){
		string s;
		cin>>s;
		For(j,0,m-1)
			v[i][j]=s[j]=='#';
	}
	prework();
	int ans=1<<n;
	For(i,0,n-1)
		Add(f[n-i][m][2],((LL)C[n][i]<<i)%mod);
	Fod(i,n,1)
		Fod(j,m,1){
			Add(res[i][j],f[i][j][1]);
			Add(res[i][j],f[i][j][2]);
			For(k,1,j-1){
				Add(g[i][j-k][1],(LL)f[i][j][2]*2*C[j][k]%mod);
				Add(g[i][j-k][1],(LL)f[i][j][1]*C[j][k]%mod);
				Add(g[i][j-k][2],(LL)f[i][j][2]*((1<<k)-2)%mod*C[j][k]%mod);
			}
			Add(ans,(LL)f[i][j][2]*((1<<j)-2)%mod);
			/********************************/
			Add(res[i][j],g[i][j][1]);
			Add(res[i][j],g[i][j][2]);
			For(k,1,i-1){
				Add(f[i-k][j][1],(LL)g[i][j][2]*2*C[i][k]%mod);
				Add(f[i-k][j][1],(LL)g[i][j][1]*C[i][k]%mod);
				Add(f[i-k][j][2],(LL)g[i][j][2]*((1<<k)-2)%mod*C[i][k]%mod);
			}
			Add(ans,(LL)g[i][j][2]*((1<<i)-2)%mod);
		}
	For(a,1,(1<<n)-1)
		For(b,1,(1<<m)-1){
			int flag=1;
			int x=0,y=0;
			For(i,0,n-1){
				if (~a>>i&1)
					continue;
				x++;
				vi c(2,0);
				For(j,0,m-1)
					if (b>>j&1)
						c[v[i][j]]++;
				if (!c[0]||!c[1])
					flag=0;
			}
			if (!flag)
				continue;
			For(j,0,m-1){
				if (~b>>j&1)
					continue;
				y++;
				vi c(2,0);
				For(i,0,n-1)
					if (a>>i&1)
						c[v[i][j]]++;
				if (!c[0]||!c[1])
					flag=0;
			}
			if (!flag)
				continue;
			Add(ans,(LL)res[x][y]*invC[n][x]%mod*invC[m][y]%mod);
		}
	cout<<ans<<endl;
	return 0;
}