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;

const int N=20,mod=998244353;

int add(int a,int b,int p=mod){return a+b>=p?a+b-p:a+b;}
int sub(int a,int b,int p=mod){return a-b<0?a-b+p:a-b;}
int mul(int a,int b,int p=mod){return (LL)a*b%p;}
void sadd(int &a,int b,int p=mod){a=add(a,b,p);}
void ssub(int &a,int b,int p=mod){a=sub(a,b,p);}
void smul(int &a,int b,int p=mod){a=mul(a,b,p);}
int Power(int a,int k,int p=mod){int res=1;for (;k;k>>=1,smul(a,a,p)) if (k&1) smul(res,a,p);return res;}
int Get_inv(int a,int p=mod){return Power(a,p-2,p);}

int n,m,r[N+9],c[N+9];
char s[N+9];

void into(){
  scanf("%d%d",&n,&m);
  for (int i=1;i<=n;++i){
	scanf("%s",s+1);
	for (int j=1;j<=m;++j) r[i]|=(s[j]=='#')<<j-1,c[j]|=(s[j]=='#')<<i-1;
  }
}

int inv[N+9],fac[N+9],ifac[N+9];

void Get_inv(){
  inv[1]=1;
  fac[0]=fac[1]=1;
  ifac[0]=ifac[1]=1;
  for (int i=2;i<=n+m;++i){
	inv[i]=mul(mod-mod/i,inv[mod%i]);
	fac[i]=mul(fac[i-1],i);
	ifac[i]=mul(ifac[i-1],inv[i]);
  }
}

int Get_c(int n,int m){return n<m||m<0?0:mul(fac[n],mul(ifac[m],ifac[n-m]));}

int dp0[N+9][N+9][3],dp1[N+9][N+9][3],ans;

void Get_dp(){
  for (int j=1;j<=m;++j) dp0[n][j][2]=mul(Get_c(m,j),1<<m-j);
  ans=1<<m;
  for (int i=n;i>=1;--i)
	for (int j=m;j>=1;--j){
	  dp0[i][j][0]=add(dp0[i][j][1],dp0[i][j][2]);
	  for (int k=1;k<i;++k){
		sadd(dp1[k][j][1],mul(Get_c(i,k),add(mul(dp0[i][j][2],2),dp0[i][j][1])));
		sadd(dp1[k][j][2],mul(Get_c(i,k),mul((1<<i-k)-2,dp0[i][j][2])));
	  }
	  sadd(ans,mul(dp0[i][j][2],(1<<i)-2));
	  dp1[i][j][0]=add(dp1[i][j][1],dp1[i][j][2]);
	  for (int k=1;k<j;++k){
		sadd(dp0[i][k][1],mul(Get_c(j,k),add(mul(dp1[i][j][2],2),dp1[i][j][1])));
		sadd(dp0[i][k][2],mul(Get_c(j,k),mul((1<<j-k)-2,dp1[i][j][2])));
	  }
	  sadd(ans,mul(dp1[i][j][2],(1<<j)-2));
	}
  for (int u=1;u<1<<n;++u)
	for (int v=1;v<1<<m;++v){
      int flag=1;
	  for (int i=0;i<n;++i)
		if (u>>i&1){
		  int t=r[i+1]&v;
		  if (!t||t==v) flag=0;
		}
	  for (int i=0;i<m;++i)
		if (v>>i&1){
		  int t=c[i+1]&u;
		  if (!t||t==u) flag=0;
		}
	  if (!flag) continue;
	  int x=0,y=0;
	  for (int i=0;i<n;++i) x+=u>>i&1;
	  for (int i=0;i<m;++i) y+=v>>i&1;
	  sadd(ans,mul(add(dp0[x][y][0],dp1[x][y][0]),Get_inv(mul(Get_c(n,x),Get_c(m,y)))));
	}
}

void work(){
  Get_inv();
  Get_dp();
}

void outo(){
  printf("%d\n",ans);
}

int main(){
  into();
  work();
  outo();
  return 0;
}