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;
typedef unsigned long long ull;
typedef long double ld;
#define mp make_pair
#define PI pair<int,int>
#define poly vector<ll>
#define mem(a) memset((a),0,sizeof(a))
#define For(i,l,r) for(int i=(int)(l);i<=(int)(r);i++)
#define Rep(i,r,l) for(int i=(int)(r);i>=(int)(l);i--)
#define pb push_back
#define fi first
#define se second
#define SZ(x) ((int)(x.size()))
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline ll read(){
	ll x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(ll a){
    if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(ll a){write(a); puts("");}
inline void wri(ll a){write(a); putchar(' ');}
ll rnd(){
	ull ans=0;
	For(i,0,4)ans=ans<<15^rand();
	return ans%((ull)1<<63);
}
const int inf=1e9,N=15,mod=998244353;
int h,w,H,W,xs[N][N],a[N][N],ycl[2000];
ll ans,pw[N],c[N][N];
char ch[N][N];
vector<int> v;
void solve(vector<int> v){
	int res[2],re[2]; res[0]=h; res[1]=w; re[0]=H; re[1]=W;
	if(!v.size()){
		ans++; return;
	}
	int ks=v[0]^1;
	//cout<<v.size()<<endl;
	//for(auto i:v)wri(i); puts("nmd"); 
	reverse(v.begin(),v.end());
	ll f=0,g=1,ab=1;
	while(v.size()){
		int cnt=0,dq=v.back();
		while(v.size()&&v.back()==dq){
			cnt++; v.pop_back();
		}
		ab=ab*c[re[dq]][cnt];
		res[dq]-=cnt; re[dq]-=cnt;
		ll G=f*(res[dq^1]?1:0)+g*(res[dq^1]?pw[cnt]:1),
		F=f*(res[dq^1]?1:0)+g*(res[dq^1]?2:1); 
		if(!ks)G=(G+mod-F)%mod; else F=ks=0;
		f=F; g=G;
		//cerr<<f<<" "<<g<<endl;
	}// f 分别表示 上次颜色全相同，上次不相同 
	//cout<<ab<<" f:"<<f<<" fdas "<<g<<" fkjzz\n";
	ans=(ans+ab*(f+g))%mod;
}
void dfs(int x,int y){
	if(!x&&!y){
		solve(v); return;
	}
	if(x){
		v.pb(0); dfs(x-1,y); v.pop_back();
	}
	if(y){
		v.pb(1); dfs(x,y-1); v.pop_back();
	}
	
}
int main(){
	#ifdef Brollan
		freopen("1.in","r",stdin);
	#endif
	h=read(),w=read();
	For(i,0,h-1){
		scanf("%s",ch[i]);
		For(j,0,w-1)a[i][j]=ch[i][j]=='.';
	}
	For(i,0,N-1)For(j,c[i][0]=1,i)c[i][j]=c[i-1][j-1]+c[i-1][j];
	For(i,1,1023)ycl[i]=ycl[i>>1]+(i&1);
	For(i,pw[0]=1,N-1)pw[i]=pw[i-1]*2;
	For(i,0,(1<<h)-1){
		For(j,0,(1<<w)-1){
			int A[N],B[N];
			mem(A); mem(B);
			For(k,0,h-1)if(i>>k&1){
				For(l,0,w-1)if(j>>l&1){
					A[k]|=1<<a[k][l];
					B[l]|=1<<a[k][l];
				}
			}
			int f=1;
			For(k,0,h-1)if((i>>k&1)&&A[k]<3)f=0;
			For(k,0,w-1)if((j>>k&1)&&B[k]<3)f=0;
			if(f)xs[h-ycl[i]][w-ycl[j]]++;
		}
	}
	ll sum=0;
	For(i,0,h)For(j,0,w)if(xs[i][j]){
		ans=0; H=i; W=j;
		dfs(i,j);
		sum=(sum+ans*xs[i][j])%mod;
		//cout<<i<<" "<<j<<" "<<xs[i][j]<<" "<<ans<<endl;// exit(0);
	}
	cout<<sum<<endl;
}
/*
对于每一行，考虑上次删了哪些列，剩余的位置相同，那些列不能和我全相同。 
*/