Problem: You have a large rectangular board which is divided into n × m cells (the board has n rows and m columns). Each cell is either white or black.

You paint each white cell either red or blue. Obviously, the number of different ways to paint them is 2^w, where w is the number of white cells.

After painting the white cells of the board, you want to place the maximum number of dominoes on it, according to the following rules:

  * each domino covers two adjacent cells; 
  * each cell is covered by at most one domino; 
  * if a domino is placed horizontally (it covers two adjacent cells in one of the rows), it should cover only red cells; 
  * if a domino is placed vertically (it covers two adjacent cells in one of the columns), it should cover only blue cells. 



Let the value of the board be the maximum number of dominoes you can place. Calculate the sum of values of the board over all 2^w possible ways to paint it. Since it can be huge, print it modulo 998 244 353.

Input

The first line contains two integers n and m (1 ≤ n, m ≤ 3 ⋅ 10^5; nm ≤ 3 ⋅ 10^5) — the number of rows and columns, respectively.

Then n lines follow, each line contains a string of m characters. The j-th character in the i-th string is * if the j-th cell in the i-th row is black; otherwise, that character is o.

Output

Print one integer — the sum of values of the board over all 2^w possible ways to paint it, taken modulo 998 244 353.

Examples

Input


3 4
**oo
oo*o
**oo


Output


144


Input


3 4
**oo
oo**
**oo


Output


48


Input


2 2
oo
o*


Output


4


Input


1 4
oooo


Output


9

Solution (in CPP):

Solution:
#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
using namespace std;
const int N = 300010;
const int mod = 998244353;

int binpow(int a, int b) {
    int res = 1;
    while (b) {
        if (b & 1) res = res * 1ll * a % mod;
        a = a * 1ll * a % mod;
        b >>= 1;
    }
    return res;
}

void solve() {
    int n, m;
    scanf("%d%d", &n, &m);
    vector<vector<char>> v(n + 1, vector<char>(m + 1, '*'));
    vector<vector<int>> cntt(n + 1, vector<int>(m + 1, 1));
    vector<vector<int>> cnts(n + 1, vector<int>(m + 1, 1));
    vector<vector<int>> t(n + 1, vector<int>(m + 1, 0));
    vector<vector<int>> s(n + 1, vector<int>(m + 1, 0));
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= m; ++j) {
            scanf(" %c", &v[i][j]);
        }
    }
    int ans1 = 0, ans2 = 0;
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= m; ++j) {
            if (v[i][j] == '*') {
                s[i][j] = s[i - 1][j];
                t[i][j] = t[i][j - 1];
                cntt[i][j] = cntt[i][j - 1];
                cnts[i][j] = cnts[i - 1][j];
            }
            if (v[i][j] == 'o') {
                s[i][j] = s[i - 1][j];
                cnts[i][j] = cnts[i - 1][j] * 2 % mod;
                cntt[i][j] = cntt[i][j - 1] * 2 % mod;
                if (v[i - 1][j] == 'o') {
                    s[i][j] = (s[i][j] + 2ll * s[i - 2][j] + cnts[i - 2][j]) % mod;
                } else {
                    s[i][j] = (s[i][j] + s[i - 1][j]) % mod;
                }

                t[i][j] = t[i][j - 1];
                if (v[i][j - 1] == 'o') {
                    t[i][j] = (t[i][j] + 2ll * t[i][j - 2] + cntt[i][j - 2]) % mod;
                } else {
                    t[i][j] = (t[i][j] + t[i][j - 1]) % mod;
                }
            }
        }
    }
    int cnta = 1, cntb = 1;
    for (int i = 1; i <= n; ++i) {
        cnta = cnta * 1ll * cntt[i][m] % mod;
    }
    for (int i = 1; i <= n; ++i) {
        ans1 += t[i][m] * 1ll * cnta % mod * binpow(cntt[i][m], mod - 2) % mod;
        ans1 %= mod;
    }

    for (int i = 1; i <= m; ++i) {
        cntb = cntb * 1ll * cnts[n][i] % mod;
    }
    for (int i = 1; i <= m; ++i) {
        ans2 += s[n][i] * 1ll * cntb % mod * binpow(cnts[n][i], mod - 2) % mod;
        ans2 %= mod;
    }
    printf("%d\n", (ans1 + ans2) % mod);
}

int main() {
#ifdef FLOWMASTER
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    solve();
    return 0;
}