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;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(a) int(a.size())
const int N=12;
const int mod=998244353;

int gi() {
	int x=0,o=1;char ch=getchar();
	while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
	if(ch=='-') o=-1,ch=getchar();
	while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
	return x*o;
}

int n,m,f[2][N][N],C[N][N],r[N],c[N];
char s[N];

int sgn(int x) {
	return x&1?1:mod-1;
}

int main() {
	for(int i=0;i<N;i++) {
		C[i][0]=1;
		for(int j=1;j<=i;j++) C[i][j]=(C[i-1][j]+C[i-1][j-1])%mod;
	}
	for(int t=0;t<2;t++) {
		for(int i=0;i<N;i++)
			for(int j=0;j<N;j++) if(!i||!j) f[t][i][j]=1<<((i+j)*t);
		for(int i=1;i<N;i++)
			for(int j=1;j<N;j++) {
				for(int k=1;k<=i;k++) f[t][i][j]=(f[t][i][j]+1ll*C[i][k]*f[t][i-k][j]%mod*sgn(k)%mod*(1<<k))%mod;
				for(int k=1;k<=j;k++) f[t][i][j]=(f[t][i][j]+1ll*C[j][k]*f[t][i][j-k]%mod*sgn(k)%mod*(1<<k))%mod;
				for(int k=1;k<=i;k++)
					for(int l=1;l<=j;l++) f[t][i][j]=(f[t][i][j]+2ll*C[i][k]*C[j][l]%mod*f[t][i-k][j-l]%mod*sgn(k+l))%mod;
			}
	}
	cin>>n>>m;
	for(int i=0;i<n;i++) {
		scanf("%s",s);
		for(int j=0;j<m;j++) if(s[j]=='#') r[i]|=1<<j,c[j]|=1<<i;
	}
	int ans=0;
	for(int i=1;i<(1<<n);i++)
		for(int j=1;j<(1<<m);j++) {
			bool fl=0;int a=0,b=0;
			for(int k=0;k<n;k++) if(i>>k&1) ++a,fl|=((r[k]&j)==j||(~r[k]&j)==j);
			for(int k=0;k<m;k++) if(j>>k&1) ++b,fl|=((c[k]&i)==i||(~c[k]&i)==i);
			if(!fl) ans=(ans+f[1][n-a][m-b])%mod;
		}
	ans=(ans+f[0][n][m])%mod;cout<<ans;
	return 0;
}