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<cstdio>
const long long mod = 998244353;
long long f[15], invf[15];
long long f0[15][15][2];
long long f1[15][15];
long long sum[15][15];
char s[15];
int a[15][15];
int b[15][15];
int cnt[2005];

long long power(long long a,long long b){
    long long res = 1;
    while(b){
        if(b&1) res = res*a%mod;
        a = a*a%mod;
        b /= 2;
    }
    return res;
}

long long inv(long long u){ return power(u,mod-2); }

void preWork(int n){
    f[0] = invf[0] = 1;
    for(long long i = 1; i <= n; i++){
        f[i] = f[i-1]*i%mod;
        invf[i] = inv(f[i]);
    }
    for(int i = 0; i < (1<<10); i++){
        cnt[i] = 0;
        int mask = i;
        while(mask){
            cnt[i] += mask%2;
            mask /= 2;
        }
    }
}

long long getC(int n,int m){
    if(m>n || m<0) return 0;
    else{
        long long res = f[n];
        res = res*invf[m]%mod;
        res = res*invf[n-m]%mod;
        return res;
    }
}

int check(int n,int m){
    for(int i = 1; i <= n; i++){
        int cnt0 = 0, cnt1 = 0;
        for(int j = 1; j <= m; j++){
            if(b[i][j]!=-1){
                if(b[i][j]==0) cnt0++;
                else cnt1++;
            }
        }
        if(!cnt0 && cnt1) return 0;
        if(!cnt1 && cnt0) return 0;
    }
    for(int j = 1; j <= m; j++){
        int cnt0 = 0, cnt1 = 0;
        for(int i = 1; i <= n; i++){
            if(b[i][j]!=-1){
                if(b[i][j]==0) cnt0++;
                else cnt1++;
            }
        }
        if(!cnt0 && cnt1) return 0;
        if(!cnt1 && cnt0) return 0;
    }
    return 1;
}

int main(){
    preWork(10);
    f0[0][0][0] = f0[0][0][1] = 1;
    for(int i = 0; i <= 10; i++){
        for(int j = 0; j <= 10; j++){
            if(i || j){
                f0[i][j][0] = f0[i][j][1] = 0;
                for(int k = i-1; k >= 0; k--) f0[i][j][0] = (f0[i][j][0] + f0[k][j][1]*invf[i-k]%mod)%mod;
                for(int k = j-1; k >= 0; k--) f0[i][j][1] = (f0[i][j][1] + f0[i][k][0]*invf[j-k]%mod)%mod;
            }
            if(i==0 && j==0) f1[i][j] = 1;
            else{
                f1[i][j] = (f0[i][j][0]+f0[i][j][1])%mod;
                f1[i][j] = f1[i][j]*f[i]%mod;
                f1[i][j] = f1[i][j]*f[j]%mod;
            }
            //printf("f1[%d][%d] = %lld\n",i,j,f1[i][j]);
        }
    }
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i = 1; i <= n; i++){ 
        scanf("%s",s+1);
        for(int j = 1; j <= m; j++){ 
            a[i][j] = s[j]=='.';
        }
    }
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            sum[i][j] = 0;
            for(int x = 0; x <= i; x++){
                for(int y = 0; y <= j; y++){
                    long long count = getC(i,x)*getC(j,y)%mod;
                    //black or white = column and row diff from color
                    count = count*f1[x][y]%mod;
                    count = count*f1[i-x][j-y]%mod;
                    sum[i][j] = (sum[i][j]+count)%mod;
                }
            }
        }
    }
    long long ans = f1[n][m];
    for(int i = 0; i < (1<<n); i++){
        for(int j = 0; j < (1<<m); j++){
            if(!i && !j) continue;
            for(int k = 0; k < n; k++){
                for(int l = 0; l < m; l++){
                    if(i&(1<<k) && j&(1<<l)) b[k+1][l+1] = a[k+1][l+1];
                    else b[k+1][l+1] = -1;
                    //if(i==3 && j==9) printf("%2d",b[k][l]);
                }
                //if(i==3 && j==9) printf("\n");
            }
            if(check(n,m)!=0){ 
                //printf("i = %d, j = %d\n",i,j);
                ans = (ans+sum[n-cnt[i]][m-cnt[j]])%mod;
            }
        }
    }
    printf("%lld\n",ans);
    return 0;
}