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<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#include<assert.h>
#include<chrono>
#include<random>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
#define SZ(x) ((int)x.size())
using namespace std;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
inline LL read()
{
	LL f=1,x=0;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];
template<typename T>inline void write(T 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');
}
template<typename T>inline void pr1(T x){write(x);putchar(' ');}
template<typename T>inline void pr2(T x){write(x);putchar('\n');}
template<typename T>inline void chkmin(T &x,T y){x=x<y?x:y;}
template<typename T>inline void chkmax(T &x,T y){x=x>y?x:y;}
const int MAXN=15;
const int mod=998244353;
int pow_mod(int a,int b)
{
	int ret=1;
	for(;b;b>>=1,a=1LL*a*a%mod)if(b&1)ret=1LL*ret*a%mod;
	return ret;
}
void ad(int &x,int y){x+=y;if(x>=mod)x-=mod;}
int C[MAXN][MAXN],bin[MAXN];
int row[MAXN][MAXN][3],col[MAXN][MAXN][3],n,m;
int ans=0;
int r[MAXN],c[MAXN];
void dp()
{
	for(int i=0;i<MAXN;i++)
	{
		C[i][0]=1;
		for(int j=1;j<=i;j++)C[i][j]=C[i-1][j],ad(C[i][j],C[i-1][j-1]);
	}bin[0]=1;for(int i=1;i<MAXN;i++)bin[i]=bin[i-1]<<1;
	for(int j=1;j<=m;j++)row[n][j][2]=1LL*C[m][j]*bin[m-j]%mod;
	ans=bin[m];
	for(int i=n;i>=1;i--)for(int j=m;j>=1;j--)
	{
		row[i][j][0]=(row[i][j][1]+row[i][j][2])%mod;
		col[i][j][0]=(col[i][j][1]+col[i][j][2])%mod;
		for(int k=1;k<i;k++)
		{
			ad(col[k][j][1],(2LL*row[i][j][2]*C[i][k]%mod+1LL*row[i][j][1]*C[i][k]%mod)%mod);
			ad(col[k][j][2],1LL*row[i][j][2]*C[i][k]%mod*(bin[i-k]-2)%mod);
		}
		ad(ans,1LL*row[i][j][2]*(bin[i]-2)%mod);
		for(int k=1;k<j;k++)
		{
			ad(row[i][k][1],(2LL*col[i][j][2]*C[j][k]%mod+1LL*col[i][j][1]*C[j][k]%mod)%mod);
			ad(row[i][k][2],1LL*col[i][j][2]*C[j][k]%mod*(bin[j-k]-2)%mod);
		}
		ad(ans,1LL*col[i][j][2]*(bin[j]-2)%mod);
	}
	for(int i=1;i<(1<<n);i++)for(int j=1;j<(1<<m);j++)
	{
		bool flag=true;
		for(int u=1;u<=n;u++)if((i&(1<<(u-1)))&&((r[u]&j)==j||(r[u]&j)==0)){flag=false;break;}
		for(int u=1;u<=m;u++)if((j&(1<<(u-1)))&&((c[u]&i)==i||(c[u]&i)==0)){flag=false;break;}
		if(!flag)continue;
		int fx=__builtin_popcount(i),fy=__builtin_popcount(j);
		ad(ans,1LL*(row[fx][fy][0]+col[fx][fy][0])*pow_mod(C[n][fx],mod-2)%mod*pow_mod(C[m][fy],mod-2)%mod);
	}
	pr2(ans);
}
char ch[MAXN][MAXN];
int main()
{
	n=read();m=read();
	for(int i=1;i<=n;i++)scanf("%s",ch[i]+1);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)if(ch[i][j]=='#')r[i]|=(1<<(j-1));
	for(int i=1;i<=m;i++)
		for(int j=1;j<=n;j++)if(ch[j][i]=='#')c[i]|=(1<<(j-1));
	dp();
	return 0;
}