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<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;
}