#include<bits/stdc++.h>
using namespace std;
#define cs const
#define re register
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define y1 shinkle
#define fi first
#define se second
#define bg begin
cs int RLEN=1<<20|1;
inline char gc(){
    static char ibuf[RLEN],*ib,*ob;
    (ib==ob)&&(ob=(ib=ibuf)+fread(ibuf,1,RLEN,stdin));
    return (ib==ob)?EOF:*ib++;
}
inline int read(){
    char ch=gc();
    int res=0;bool f=1;
    while(!isdigit(ch))f^=ch=='-',ch=gc();
    while(isdigit(ch))res=(res*10)+(ch^48),ch=gc();
    return f?res:-res;
}
inline ll readll(){
    char ch=gc();
    ll res=0;bool f=1;
    while(!isdigit(ch))f^=ch=='-',ch=gc();
    while(isdigit(ch))res=(res*10)+(ch^48),ch=gc();
    return f?res:-res;
}
inline char readchar(){
	char ch=gc();
	while(isspace(ch))ch=gc();
	return ch;
}
inline int readstring(char *s){
	int top=0;char ch=gc();
	while(isspace(ch))ch=gc();
	while(!isspace(ch)&&ch!=EOF)s[++top]=ch,ch=gc();
	s[top+1]='\0';return top;
}
template<typename tp>inline void chemx(tp &a,tp b){a=max(a,b);}
template<typename tp>inline void chemn(tp &a,tp b){a=min(a,b);}
cs int mod=998244353;
inline int add(int a,int b){return (a+b)>=mod?(a+b-mod):(a+b);}
inline int dec(int a,int b){return (a<b)?(a-b+mod):(a-b);}
inline int mul(int a,int b){static ll r;r=(ll)a*b;return (r>=mod)?(r%mod):r;}
inline void Add(int &a,int b){a=(a+b)>=mod?(a+b-mod):(a+b);}
inline void Dec(int &a,int b){a=(a<b)?(a-b+mod):(a-b);}
inline void Mul(int &a,int b){static ll r;r=(ll)a*b;a=(r>=mod)?(r%mod):r;}
inline int ksm(int a,int b,int res=1){for(;b;b>>=1,Mul(a,a))(b&1)&&(Mul(res,a),1);return res;}
inline int Inv(int x){return ksm(x,mod-2);}
inline int fix(ll x){x%=mod;return (x<0)?x+mod:x;}
cs int N=12;
int fac[N],ifac[N];
inline void init_fac(){
	fac[0]=ifac[0]=1;
	for(int i=1;i<N;i++)fac[i]=mul(fac[i-1],i);
	ifac[N-1]=Inv(fac[N-1]);
	for(int i=N-2;i;i--)ifac[i]=mul(ifac[i+1],i+1);
}
inline int C(int n,int m){return (n<m||n<0||m<0)?0:mul(fac[n],mul(ifac[m],ifac[n-m]));}
inline int IC(int n,int m){return (n<m||n<0||m<0)?0:mul(ifac[n],mul(fac[m],fac[n-m]));}
int n,m,sl[N],sr[N],ln[N][N][3],rw[N][N][3],ans[N][N];
char str[N][N];
int main(){
	#ifdef Stargazer
	freopen("lx.in","r",stdin);
	#endif
	n=read(),m=read(),init_fac();
	for(int i=1;i<=n;i++)readstring(str[i]);
	for(int i=1;i<=n;i++)
	for(int j=1;j<=m;j++)sl[i]+=(str[i][j]=='#')<<(j-1);
	for(int i=1;i<=m;i++)
	for(int j=1;j<=n;j++)sr[i]+=(str[j][i]=='#')<<(j-1);
	for(int i=1;i<=n;i++)ln[i][m][2]=mul(C(n,i),1<<(n-i));
	int res=1<<n;
	for(int i=n;i;i--)
	for(int j=m;j;j--){
		ans[i][j]=add(add(rw[i][j][1],rw[i][j][2]),add(ln[i][j][1],ln[i][j][2]));
		Add(res,mul(rw[i][j][2],(1<<i)-2)),Add(res,mul(ln[i][j][2],(1<<j)-2));
		for(int k=1;k<i;k++){
			Add(ln[k][j][2],mul(rw[i][j][2],mul((1<<(i-k))-2,C(i,k))));
			Add(ln[k][j][1],mul(add(mul(rw[i][j][2],2),rw[i][j][1]),C(i,k)));
		}
		for(int k=1;k<j;k++){
			Add(rw[i][k][2],mul(ln[i][j][2],mul((1<<(j-k))-2,C(j,k))));
			Add(rw[i][k][1],mul(add(mul(ln[i][j][2],2),ln[i][j][1]),C(j,k)));
		}
	}
	for(int i=1;i<(1<<n);i++)
	for(int j=1;j<(1<<m);j++){
		int c1=0,c2=0,fg=0;
		for(int k=1;k<=n&&!fg;k++)if(i&(1<<(k-1))){
			int sta=sl[k]&j;c1++;
			if(sta==j||sta==0)fg=1;
		}
		for(int k=1;k<=m&&!fg;k++)if(j&(1<<(k-1))){
			int sta=sr[k]&i;c2++;
			if(sta==i||sta==0)fg=1;
		}
		if(fg)continue;
		Add(res,mul(ans[c1][c2],mul(IC(n,c1),IC(m,c2))));
	}cout<<res<<'\n';return 0;
}

Measured memory_bytes: 384