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;

#define rep(i, N) for (int i = 0; i < (N); i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back

using ll = long long;
using i_i = tuple<int, int>;

const int N = 10;
const int MOD = 998244353;

ll dp[N + 1][N + 1][2][2][2][2];

int main() {
    vector<vector<ll>> comb(N + 1, vector<ll>(N + 1));
    rep(x, N + 1) {
        comb[x][0] = 1;
        for (int y = 1; y <= x; y++)
            comb[x][y] = (comb[x - 1][y - 1] + comb[x - 1][y]) % MOD;
    }
    
    vector<vector<ll>> nibu(N + 1, vector<ll>(N + 1));
    rep(s, N * 2 + 1) rep(r, s + 1) {
        int c = s - r;
        if (r <= N && c <= N) {
            if (r == 0 || c == 0) nibu[r][c] = 1;
            else {
                for (int i = 1; i <= r; i++)
                    nibu[r][c] = (nibu[r][c] + nibu[c][r - i] * comb[r][i]) % MOD;
            }
        }
    }
    
    rep(r, N + 1) rep(c, N + 1) {
        if (r == 0 || c == 0) {
            rep(wr, 2) rep(wc, 2) rep(br, 2) rep(bc, 2) dp[r][c][wr][wc][br][bc] = 1;
        }
        else {
            rep(wr, 2) rep(wc, 2) rep(br, 2) rep(bc, 2) {
                if (wr && wc) dp[r][c][wr][wc][br][bc] += 1;
                if (br && bc) dp[r][c][wr][wc][br][bc] += 1;
                rep(iw, r) rep(ib, r) rep(jw, c) rep(jb, c) if (iw + ib + jw + jb > 0 && iw + ib <= r && jw + jb <= c) {
                    if (iw && jb) continue;
                    if (ib && jw) continue;
                    if (!wr && iw > 0) continue;
                    if (!wc && jw > 0) continue;
                    if (!br && ib > 0) continue;
                    if (!bc && jb > 0) continue;
                    int _wr = (jb > 0);
                    int _wc = (ib > 0);
                    int _br = (jw > 0);
                    int _bc = (iw > 0);
                    ll z = comb[r][iw] % MOD * comb[r - iw][ib] % MOD * comb[c][jw] % MOD * comb[c - jw][jb] % MOD;
                    dp[r][c][wr][wc][br][bc] = (dp[r][c][wr][wc][br][bc] + dp[r - iw - ib][c - jw - jb][_wr][_wc][_br][_bc] * z) % MOD;
                }
            }
        }
    }
    
    
    
    /*
    for (;;) {
        int r, c; cin >> r >> c;
        cout << dp[r][c][1][1][1][1] << endl;
    }
    */
    
    int H, W;
    cin >> H >> W;
    vector<vector<bool>> a(H, vector<bool>(W));
    rep(y, H) {
        string s; cin >> s;
        rep(x, W) a[y][x] = (s[x] == '#');
    }
    ll ans = dp[H][W][1][1][1][1];
    rep(S, 1<<H) rep(T, 1<<W) if (S && T) {
        bool ok = true;
        rep(y, H) if (S>>y & 1) {
            int z[2] = {0, 0};
            rep(x, W) if (T>>x & 1) z[a[y][x]] = 1;
            if (!z[0] || !z[1]) ok = false;
        }
        rep(x, W) if (T>>x & 1) {
            int z[2] = {0, 0};
            rep(y, H) if (S>>y & 1) z[a[y][x]] = 1;
            if (!z[0] || !z[1]) ok = false;
        }
        if (ok) {
            int R = H - __builtin_popcount(S);
            int C = W - __builtin_popcount(T);
            rep(wr, R + 1) rep(wc, C + 1) {
                int br = R - wr;
                int bc = C - wc;
                ll waf = (wr && bc) ? (nibu[wr][bc] + nibu[bc][wr]) : 1;
                ll rel = (wc && br) ? (nibu[wc][br] + nibu[br][wc]) : 1;
                ll z = comb[R][wr] * comb[C][wc] % MOD * waf % MOD * rel % MOD;
                ans = (ans + z) % MOD;
            }
        }
    }
    cout << ans << endl;
}