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<cstdio>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<cstring>
using namespace std;
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9')x=x*10+ch-'0',ch=getchar();
	return x*f;
}
int stack[20];
inline void write(int x)
{
	if(x<0){putchar('-');x=-x;}
	if(!x){putchar('0');return;}
	int top=0;
	while(x)stack[++top]=x%10,x/=10;
	while(top)putchar(stack[top--]+'0');
}
inline void pr1(int x){write(x),putchar(' ');}
inline void pr2(int x){write(x),puts("");}
const int mod=998244353;
inline int ad(int x){return x>=mod?x-mod:x;}
inline int dec(int x){return x<0?x+mod:x;}
char ss[15];
int n,m,a[15][15],row[15],col[15];
inline bool pd(int x,int y)
{
	if(x==0 && y==0)return true;
	if(x==0 || y==0)return false;
	for(int i=0;i<n;i++)if(x>>i&1 && ((row[i]&y)==y || (row[i]&y)==0))return false;
	for(int i=0;i<m;i++)if(y>>i&1 && ((col[i]&x)==x || (col[i]&x)==0))return false;
	return true;
}
int C[15][15],f[15][15][3],g[15][15][3];
int main()
{
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	for(int i=0;i<=10;i++)
	{
		C[i][0]=1;
		for(int j=1;j<=i;j++)C[i][j]=ad(C[i-1][j]+C[i-1][j-1]);
	}
	n=read(),m=read();
	for(int i=0;i<n;i++)
	{
		scanf("%s",ss);
		for(int j=0;j<m;j++)a[i][j]=ss[j]=='.';
	}
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)row[i]+=a[i][j]<<j;
	}
	for(int i=0;i<m;i++)
	{
		for(int j=0;j<n;j++)col[i]+=a[j][i]<<j;
	}
	for(int i=0;i<m;i++)f[0][i][2]=1<<i;
	f[n][m][0]=1<<m;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			for(int k=1;k<n-i;k++)
			{
				g[i+k][j][1]=ad(g[i+k][j][1]+1LL*ad(f[i][j][1]+ad(f[i][j][2]*2))*C[k+i][i]%mod);
				g[i+k][j][2]=ad(g[i+k][j][2]+1LL*f[i][j][2]*dec((1<<k)-2)%mod*C[k+i][i]%mod);
			}
			g[n][m][0]=ad(g[n][m][0]+1LL*f[i][j][2]*dec((1<<(n-i))-2)%mod*C[n][i]%mod*C[m][j]%mod);
			for(int k=1;k<m-j;k++)
			{
				f[i][j+k][1]=ad(f[i][j+k][1]+1LL*ad(g[i][j][1]+ad(g[i][j][2]*2))*C[k+j][j]%mod);
				f[i][j+k][2]=ad(f[i][j+k][2]+1LL*g[i][j][2]*dec((1<<k)-2)%mod*C[k+j][j]%mod);
			}
			f[n][m][0]=ad(f[n][m][0]+1LL*g[i][j][2]*dec((1<<(m-j))-2)%mod*C[m][j]%mod*C[n][i]%mod);
		}
	}
	int ans=0;
	for(int i=0;i<(1<<n);i++)
	{
		for(int j=0;j<(1<<m);j++)
		{
			if(pd(i,j)==false)continue;
			int x=n,y=m;
			for(int k=0;k<n;k++)if(i>>k&1)x--;
			for(int k=0;k<m;k++)if(j>>k&1)y--;
			for(int k=0;k<3;k++)ans=ad(ans+ad(f[x][y][k]+g[x][y][k]));
		}
	}pr2(ans);
	return 0;
}