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>
using namespace std;

const int64_t MOD = 998244353;
void add(int64_t& a, int64_t b){
    a = (a+b) % MOD;
}
void mul(int64_t& a, int64_t b){
    a = a*b % MOD;
}

vector<int64_t> fact, seq_inv, fact_inv;

void create_fact_mod(int num){
    fact[0] = fact[1] = 1;
    for(int i=2; i<=num; i++) fact[i] = fact[i-1] * i % MOD;
}

void create_seq_inv_mod(int num){
    seq_inv[0] = seq_inv[1] = 1;
    for(int i=2; i<=num; i++) seq_inv[i] = (MOD - MOD/i) * seq_inv[MOD%i] % MOD;
}

void create_fact_inv_mod(int num){
    fact_inv[0] = fact_inv[1] = 1;
    for(int i=2; i<=num; i++) fact_inv[i] = fact_inv[i-1] * seq_inv[i] % MOD;
}

void create_mod_tables(int num){
    fact.resize(num+1);
    seq_inv.resize(num+1);
    fact_inv.resize(num+1);
    create_fact_mod(num);
    create_seq_inv_mod(num);
    create_fact_inv_mod(num);
}

int64_t comb_mod(int n, int k){
    return fact[n] * fact_inv[n-k] % MOD * fact_inv[k] % MOD;
}

int64_t perm_mod(int n, int k){
    return fact[n] * fact_inv[n-k] % MOD;
}

int64_t power_mod(int64_t num, int64_t power){
    int64_t prod = 1;
    num %= MOD;
    while(power > 0){
        if(power&1) prod = prod * num % MOD;
        num = num * num % MOD;
        power >>= 1;
    }
    return prod;
}

int64_t extgcd(int64_t a, int64_t b, int64_t& x, int64_t& y){
    int64_t d = a;
    if(b != 0){
        d = extgcd(b, a%b, y, x);
        y -= (a/b) * x;
    }else{
        x = 1; y = 0;
    }
    return d;
}

int64_t inv_mod(int64_t a){
    int64_t x, y;
    extgcd(a, MOD, x, y);
    return (MOD + x%MOD) % MOD;
}

int nth_bit(int64_t num, int n){
    return (num >> n) & 1;
}

int main(){
    int H, W;
    cin >> H >> W;
    bitset<10> S[10];
    for(int i=0; i<H; i++){
        string s;
        cin >> s;
        for(int j=0; j<W; j++) S[i][j] = (s[j] == '.');
    }
    create_mod_tables(100);

    static int64_t Y[11][11][3], Ysum[11][11];
    Y[0][0][2] = 1;
    for(int i=0; i<=10; i++) for(int j=0; j<=10; j++){
        for(int k=0; k<3; k++){
            add(Ysum[i][j], Y[i][j][k]);
            if(k != 0) for(int x=1; i+x<=10; x++) add(Y[i+x][j][0], Y[i][j][k] * fact_inv[x]);
            if(k != 1) for(int x=1; j+x<=10; x++) add(Y[i][j+x][1], Y[i][j][k] * fact_inv[x]);
        }
        mul(Ysum[i][j], fact[i] * fact[j] % MOD);
    }

    static int64_t Lparts[11][11];
    for(int x=0; x<H; x++) for(int y=0; y<W; y++){
        for(int x1=0; x1<=x; x1++) for(int y1=0; y1<=y; y1++){
            int64_t res = comb_mod(x, x1) * comb_mod(y, y1) % MOD;
            mul(res, Ysum[x1][y1]);
            mul(res, Ysum[x-x1][y-y1]);
            add(Lparts[x][y], res);
        }
    }

    int64_t ans = Ysum[H][W];
    for(int b1=0; b1<(1<<H); b1++) for(int b2=0; b2<(1<<W); b2++){
        if(b1 == 0 && b2 == 0) continue;
        vector<int> is, js;
        for(int i=0; i<H; i++) if(nth_bit(b1, i)) is.push_back(i);
        for(int j=0; j<W; j++) if(nth_bit(b2, j)) js.push_back(j);
        int isz = is.size(), jsz = js.size();
        bool ok = true;
        for(int i : is){
            int sum = 0;
            for(int j : js) sum += S[i][j];
            if(sum == 0 || sum == jsz) ok = false;
        }
        for(int j : js){
            int sum = 0;
            for(int i : is) sum += S[i][j];
            if(sum == 0 || sum == isz) ok = false;
        }
        if(ok) add(ans, Lparts[H-isz][W-jsz]);
    }
    cout << ans << endl;
    return 0;
}