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 <bits/stdc++.h>
using namespace std;
#define pii pair<int, int>
#define x first
#define y second
using ll = long long;
const ll maxn = 3e5 + 1, mod = 998244353;
ll dp2[maxn][2], cnt[maxn], pow2[maxn], dp[maxn], cnt0[maxn][2], cnt2[maxn][2];
vector<bool> a[maxn], b[maxn];

signed main() {
    ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    int n, m;
    cin >> n >> m;
    int w = 0;
    for (int i = 0; i < n; ++i) {
        a[i].resize(m);
        for (int j = 0; j < m; ++j) {
            char c;
            cin >> c;
            if (c == '*') {
                a[i][j] = false;
            }
            else {
                ++w;
                a[i][j] = true;
            }
        }
    }
    dp[1] = 1;
    dp2[1][1] = 1;
    cnt[1] = 1;
    pow2[0] = 1;
    pow2[1] = 2;
    cnt0[0][0] = 1;
    cnt0[0][1] = 1;
    cnt2[1][1] = 1;
    for (int i = 1; i < maxn; ++i) {
        cnt0[i][0] = (cnt0[i - 1][0] + cnt0[i - 1][1]) % mod;
        cnt0[i][1] = cnt0[i - 1][0];
    }
    for (int i = 2; i < maxn; ++i) {
        dp2[i][0] = (dp[i - 1]) % mod;
        dp2[i][1] = (dp2[i - 1][0] + dp[i - 2] + cnt[i - 2] + (cnt0[i - 2][0] + cnt0[i - 2][1]) % mod) % mod;
        dp[i] = (dp2[i][0] + dp2[i][1]) % mod;
        cnt2[i][0] = cnt[i - 1];
        cnt2[i][1] = (cnt2[i - 1][0] + cnt[i - 2] + (cnt0[i - 2][0] + cnt0[i - 2][1]) % mod) % mod;
        cnt[i] = (cnt2[i][0] + cnt2[i][1]) % mod;
        pow2[i] = (pow2[i - 1] * 2) % mod;
    }
    ll ans = 0;
    for (int i = 0; i < n; ++i) {
        int j = 0;
        while (j < m && !a[i][j]) ++j;
        while (j < m) {
            int l = j;
            int r = j;
            while (r < m && a[i][r]) ++r;
            assert(w - (r - l) >= 0 && r - l - 1 >= 0);
            ans = (ans + (pow2[w - (r - l)] * dp[r - l - 1]) % mod) % mod;
            j = r;
            while (j < m && !a[i][j]) ++j;
        }
    }
    for (int i = 0; i < m; ++i) {
        b[i].resize(n);
        for (int j = 0; j < n; ++j) b[i][j] = a[j][i];
    }
    swap(n, m);
    for (int i = 0; i < n; ++i) {
        int j = 0;
        while (j < m && !b[i][j]) ++j;
        while (j < m) {
            int l = j;
            int r = j;
            while (r < m && b[i][r]) ++r;
            assert(w - (r - l) >= 0 && r - l - 1 >= 0);
            ans = (ans + (pow2[w - (r - l)] * dp[r - l - 1]) % mod) % mod;
            j = r;
            while (j < m && !b[i][j]) ++j;
        }
    }
    cout << ans;
}