#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=998244353 ;



vector<ll> inv,fact,invfact;
void mod_build(int n=101010){
    fact.resize(n+1);
    inv.resize(n+1);
    invfact.resize(n+1);
    fact[0]=inv[0]=invfact[0]=1;
    inv[1]=1;
    rep(i,n){
        fact[i+1]=fact[i]*(i+1)%mod;
        if(i>0)inv[i+1]=mod-inv[mod%(i+1)]*(mod/(i+1))%mod;
        invfact[i+1]=invfact[i]*inv[i+1]%mod;
    }
}
ll perm(int n,int k){
    if(n<0||k<0||k>n)return 0;
    return fact[n]*invfact[n-k]%mod;
}
ll comb(int n,int k){
    if(n<0||k<0||k>n)return 0;
    return (fact[n]*invfact[n-k]%mod)*invfact[k]%mod;
}
ll powmod(ll n,ll k){
    k%=mod-1;
    if(k<0)k+=mod-1;
    ll ret=1;
    while(k){
        if(k&1)ret=ret*n%mod;
        n=n*n%mod;
        k>>=1;
    }
    return ret;
}

ll dp[30][30][30],dp2[30][30],dp3[30][30][30][30][30],dp4[30][30];
int r[13], c[13];

int main(){
    int h,w;
    cin>>h>>w;
    mod_build();
    int N = 13;
    rep(i,N+1)rep(j,N+1)dp[i][j][0]=1;
    rep(i,N+1)rep(j,N+1)rep(k,N)REP(ni,i+1,N+1)REP(nk,k+1,N+1){
        dp[ni][j][nk]+=dp[i][j][k]*comb(ni,i)%mod*comb(j-k,nk-k)%mod;
        dp[ni][j][nk]%=mod;
    }
    rep(i,N+1)rep(j,N+1)rep(k,N+1)dp2[i][j]+=dp[i][j][k];
    rep(i,N+1)rep(j,N+1){
        dp3[i][j][0][0][0]+=1;
        dp3[i][j][0][0][j]+=(1<<i)-1;
    }
    rep(i,N+1)rep(j,N+1)rep(s,N+1)rep(k,j+1)rep(l,j-k+1)REP(ni,i+1,N+1)REP(nk,s+1,N+1){
        if(l==0){
            if(nk+l<=j)(dp3[ni][j][nk][nk][l]+=dp3[i][j][s][k][l]*comb(ni,i)%mod*comb(j-s,nk-s)%mod)%=mod;
            if(nk<=j && k+j-nk<=j)(dp3[ni][j][nk][k][j-nk]+=dp3[i][j][s][k][l]*comb(ni,i)%mod*comb(j-s,nk-s)%mod)%=mod;
            if(nk<=j)(dp3[ni][j][nk][nk][j-nk]+=dp3[i][j][s][k][l]*comb(ni,i)%mod*comb(j-s,nk-s)%mod*((1<<(ni-i))-2)%mod)%=mod;
        }
        else {
            (dp3[ni][j][nk][k][l]+=dp3[i][j][s][k][l]*comb(ni,i)%mod*comb(j-s,nk-s)%mod)%=mod;
        }
    }
    rep(i,N+1)rep(j,N+1)rep(s,N+1)rep(k,N+1)rep(l,N+1){
        if(k+l<=j)dp4[i][j]+=dp3[i][j][s][k][l]*(1<<(j-k-l))%mod;
        dp4[i][j]%=mod;
    }
    string s[h];
    rep(i,h)cin>>s[i];
    rep(i,h){
        rep(j,w)if(s[i][j]=='#')c[i]|=(1<<j);
    }
    rep(j,w){
        rep(i,h)if(s[i][j]=='#')r[j]|=(1<<i);
    }
    int hh = 1<<h, ww = 1<<w;
    ll ans = 0;
    rep(mi,hh)rep(mj,ww){
        int ci = h-__builtin_popcount(mi);
        int cj = w-__builtin_popcount(mj);
        bool ok = true;
        rep(i,h){
            if(((1<<i)&mi)==0)continue;
            if((c[i] & mj)==0||(c[i] & mj)==mj){
                ok=false;
            }
        }
        rep(j,w){
            if(((1<<j)&mj)==0)continue;
            if((r[j] & mi)==0||(r[j] & mi)==mi){
                ok=false;
            }
        }
        if(ok){
            if(mi || mj){
                ans += dp4[ci][cj];
            }
            else ans += dp2[ci][cj];
        }
    }
    cout<<ans%mod<<endl;
    return 0;
}


Measured memory_bytes: 68480