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>
#define rep(i,l,r) for (int i=l,i##end=r;i<=i##end;++i)
#define per(i,r,l) for (int i=r,i##end=l;i>=i##end;--i)
#define ll long long
using namespace std;
const int N=15,S=1500,P=998244353;
int C[N][N],cnt[S],sr[N],sc[N],dpr[N][N][3],dpc[N][N][3];
int add(int x,int y){ x+=y; return x>=P?x-P:x; }
int fpw(int x,int y){
    int s=1; for (;y;y>>=1,x=(ll)x*x%P) if (y&1) s=(ll)s*x%P;
    return s;
}
int main(){
    int n,m; cin>>n>>m;
    rep(i,0,max(n,m)){
        C[i][0]=1;
        rep(j,1,i) C[i][j]=add(C[i-1][j],C[i-1][j-1]);
    }
    rep(i,1,n){
        char s[N]; cin>>s;
        rep(j,1,m)
            if (s[j-1]=='#') sr[i]|=1<<j-1,sc[j]|=1<<i-1;
    }
    rep(s,1,(1<<max(n,m))-1)
        rep(i,1,max(n,m)) cnt[s]+=s>>i-1&1;
    rep(j,1,m) dpc[n][j][2]=(ll)C[m][j]*(1<<m-j)%P;
    int ans=1<<m;
    per(i,n,1)
        per(j,m,1){
            dpc[i][j][0]=add(dpc[i][j][1],dpc[i][j][2]);
            rep(k,1,i-1){
                dpr[k][j][1]=add(dpr[k][j][1],(ll)add(add(dpc[i][j][2],dpc[i][j][2]),dpc[i][j][1])*C[i][k]%P);
                dpr[k][j][2]=add(dpr[k][j][2],(ll)((1<<i-k)-2)*dpc[i][j][2]%P*C[i][k]%P);
            }
            ans=(ans+(ll)dpc[i][j][2]*((1<<i)-2))%P;
            dpr[i][j][0]=add(dpr[i][j][1],dpr[i][j][2]);
            rep(k,1,j-1){
                dpc[i][k][1]=add(dpc[i][k][1],(ll)add(add(dpr[i][j][2],dpr[i][j][2]),dpr[i][j][1])*C[j][k]%P);
                dpc[i][k][2]=add(dpc[i][k][2],(ll)((1<<j-k)-2)*dpr[i][j][2]%P*C[j][k]%P);
            }
            ans=(ans+(ll)dpr[i][j][2]*((1<<j)-2)%P);
        }
    rep(s1,1,(1<<n)-1)
        rep(s2,1,(1<<m)-1){
            bool f=false;
            rep(i,1,n)
                if (s1>>i-1&1){
                    int c=cnt[sr[i]&s2]; f=f||c==0||c==cnt[s2];
                }
            rep(i,1,m)
                if (s2>>i-1&1){
                    int c=cnt[sc[i]&s1]; f=f||c==0||c==cnt[s1];
                }
            if (!f){
                int coef=fpw((ll)C[n][cnt[s1]]*C[m][cnt[s2]]%P,P-2);
                ans=add(ans,(ll)add(dpc[cnt[s1]][cnt[s2]][0],dpr[cnt[s1]][cnt[s2]][0])*coef%P);
            }
        }
    cout<<ans<<endl;
    return 0;
}