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 llong long long
#define mkpr make_pair
#define x first
#define y second
#define iter iterator
#define riter reversed_iterator
#define y1 Lorem_ipsum_
#define tm dolor_sit_amet_
using namespace std;

inline int read()
{
	int x = 0,f = 1; char ch = getchar();
	for(;!isdigit(ch);ch=getchar()) {if(ch=='-') f = -1;}
	for(; isdigit(ch);ch=getchar()) {x = x*10+ch-48;}
	return x*f;
}

const int mxN = 10;
const int P = 998244353;
char a[mxN+3][mxN+3];
int row[mxN+3],col[mxN+3];
llong f[mxN+3][mxN+3][2],g[mxN+3][mxN+3][2],h[mxN+3][mxN+3];
llong comb[mxN+3][mxN+3],combi[mxN+3][mxN+3];
int n,m;

void updsum(llong &x,llong y) {x+=y-P,x+=(x>>31)&P;}

llong quickpow(llong x,llong y)
{
	if(y==0ll) {return 1ll;}
	llong ret = quickpow(x,y>>1); ret = ret*ret%P; if(y&1ll) ret = ret*x%P;
	return ret;
}
llong mulinv(llong x) {return quickpow(x,P-2);}
void initcomb(int n)
{
	comb[0][0] = 1ll;
	for(int i=1; i<=n; i++) {comb[i][0] = comb[i][i] = 1ll; for(int j=1; j<i; j++) {updsum(comb[i][j]=comb[i-1][j-1],comb[i-1][j]);}}
	for(int i=0; i<=n; i++) for(int j=0; j<=i; j++) {combi[i][j] = mulinv(comb[i][j]);}
}

int main()
{
	initcomb(mxN);
	n = read(),m = read();
	for(int i=0; i<n; i++) {scanf("%s",a[i]); for(int j=0; j<m; j++) a[i][j] = (a[i][j]=='#'?1:0),row[i]|=(a[i][j]<<j),col[j]|=(a[i][j]<<i);}
	llong ans = (1<<m);
	for(int i=0; i<m; i++) {g[0][i][1] = 1ll<<i;}
	for(int i=0; i<n; i++)
	{
		for(int j=0; j<m; j++)
		{
			for(int k=1; k<=i; k++)
			{
				llong tmp = (g[i-k][j][0]+g[i-k][j][1]*2ll)*comb[i][k]%P;
				updsum(f[i][j][0],tmp);
				tmp = g[i-k][j][1]*((1ll<<k)-2ll)%P*comb[i][k]%P;
				updsum(f[i][j][1],tmp);
			}
			for(int k=1; k<=j; k++)
			{
				llong tmp = (f[i][j-k][0]+f[i][j-k][1]*2ll)*comb[j][k]%P;
				updsum(g[i][j][0],tmp);
				tmp = f[i][j-k][1]*((1ll<<k)-2ll)%P*comb[j][k]%P;
				updsum(g[i][j][1],tmp);
			}
			h[i][j] = (f[i][j][0]+f[i][j][1]+g[i][j][0]+g[i][j][1])%P;
			llong coe = comb[n][i]*comb[m][j]%P;
			updsum(ans,f[i][j][1]*coe%P*((1ll<<m-j)-2ll)%P);
			updsum(ans,g[i][j][1]*coe%P*((1ll<<n-i)-2ll)%P);
		}
	}
	for(int i=1; i<(1<<n); i++)
	{
		for(int j=1; j<(1<<m); j++)
		{
			bool ok = true; int cnt1 = 0,cnt2 = 0;
			for(int k=0; k<n; k++) if(i&(1<<k))
			{
				cnt1++;
				if((row[k]&j)==j||(row[k]&j)==0) {ok = false; break;}
			}
			for(int k=0; k<m; k++) if(j&(1<<k))
			{
				cnt2++;
				if((col[k]&i)==i||(col[k]&i)==0) {ok = false; break;}
			}
			if(!ok) continue;
			updsum(ans,h[n-cnt1][m-cnt2]);
		}
	}
	printf("%lld\n",ans);
	return 0;
}