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 SIZE 12
#define BT (1<<10)
#define MOD 998244353
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

char mp[SIZE][SIZE];
int dp[SIZE][SIZE];
int dp2[SIZE][SIZE];
int C[SIZE][SIZE];
int bit[SIZE];
int bit2[SIZE];
int rt[SIZE];

void make()
{
	for(int i=0;i<SIZE;i++)
	{
		C[i][i]=C[i][0]=1;
		for(int j=1;j<i;j++) C[i][j]=(C[i-1][j-1]+C[i-1][j])%MOD;
	}
	rt[0]=1;
	for(int i=1;i<SIZE;i++) rt[i]=rt[i-1]*2%MOD;
	//dp[0][0]=1;
	for(int i=0;i<SIZE;i++) for(int j=0;j<SIZE;j++) if(i==0||j==0) dp[i][j]=1;
	for(int i=1;i<SIZE;i++)
	{
		for(int j=1;j<SIZE;j++)
		{
			dp[i][j]=0;
			for(int k=1;k<=i;k++)
			{
				ll way=C[i][k]*rt[k]%MOD*(ll) dp[i-k][j]%MOD;
				if(k%2==0) way=MOD-way;
				dp[i][j]+=way;
				if(dp[i][j]>=MOD) dp[i][j]-=MOD;
			}
			for(int k=1;k<=j;k++)
			{
				ll way=C[j][k]*rt[k]%MOD*(ll) dp[i][j-k]%MOD;
				if(k%2==0) way=MOD-way;
				dp[i][j]+=way;
				if(dp[i][j]>=MOD) dp[i][j]-=MOD;
			}
			for(int k=1;k<=i;k++)
			{
				for(int l=1;l<=j;l++)
				{
					ll way=C[i][k]*C[j][l]%MOD*(ll) dp[i-k][j-l]%MOD*2LL%MOD;
					if((k+l)%2==0) way=MOD-way;
					dp[i][j]+=way;
					if(dp[i][j]>=MOD) dp[i][j]-=MOD;
				}
			}
		}
	}
	
	for(int i=0;i<SIZE;i++) for(int j=0;j<SIZE;j++) if(i==0||j==0) dp2[i][j]=rt[i+j];
	for(int i=1;i<SIZE;i++)
	{
		for(int j=1;j<SIZE;j++)
		{
			dp2[i][j]=0;
			for(int k=1;k<=i;k++)
			{
				ll way=C[i][k]*rt[k]%MOD*(ll) dp2[i-k][j]%MOD;
				if(k%2==0) way=MOD-way;
				dp2[i][j]+=way;
				if(dp2[i][j]>=MOD) dp2[i][j]-=MOD;
			}
			for(int k=1;k<=j;k++)
			{
				ll way=C[j][k]*rt[k]%MOD*(ll) dp2[i][j-k]%MOD;
				if(k%2==0) way=MOD-way;
				dp2[i][j]+=way;
				if(dp2[i][j]>=MOD) dp2[i][j]-=MOD;
			}
			for(int k=1;k<=i;k++)
			{
				for(int l=1;l<=j;l++)
				{
					ll way=C[i][k]*C[j][l]%MOD*(ll) dp2[i-k][j-l]%MOD*2LL%MOD;
					if((k+l)%2==0) way=MOD-way;
					dp2[i][j]+=way;
					if(dp2[i][j]>=MOD) dp2[i][j]-=MOD;
				}
			}
		}
	}
}
int main()
{
	make();
	int n,m;
	scanf("%d %d",&n,&m);
	for(int i=0;i<n;i++)
	{
		scanf("%s",&mp[i]);
		for(int j=0;j<m;j++) if(mp[i][j]=='#') bit[i]|=(1<<j),bit2[j]|=(1<<i);
	}
	int ret=dp[n][m];
	for(int S=1;S<(1<<n);S++)
	{
		for(int T=1;T<(1<<m);T++)
		{
			bool up=true;
			for(int i=0;i<n;i++)
			{
				if(S>>i&1)
				{
					if((T&bit[i])==T||(((1<<m)-bit[i]-1)&T)==T)
					{
						//if(S==3&&T==3) printf("%d\n",i);
						up=false;
					}
				}
			}
			for(int i=0;i<m;i++)
			{
				if(T>>i&1)
				{
					if((S&bit2[i])==S||(((1<<n)-bit2[i]-1)&S)==S)
					{
						//if(S==3&&T==3) printf("%d\n",i);
						up=false;
					}
				}
			}
			if(up)
			{
				int w=0,h=0;
				for(int i=0;i<n;i++) if(S>>i&1) w++;
				for(int j=0;j<m;j++) if(T>>j&1) h++;
				//printf("%d %d : %d\n",w,h,dp[n-w][m-h]);
				ret+=dp2[n-w][m-h];
				if(ret>=MOD) ret-=MOD;
			}
		}
	}
	printf("%d\n",ret);
	return 0;
}