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>

#define int long long
#define all(x) x.begin(), x.end()

using namespace std;

const int mod = 998244353;
const int MAXN = 300500;

int pow_[MAXN];
int val[MAXN];

int sol(vector<string> &a) {
    int n = a.size(), m = a[0].size();
    vector<vector<int>> dp(n, vector<int>(m));
    int W = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (a[i][j] == '*') {
                continue;
            }
            W++;
            dp[i][j] = 1;
            if (j > 0) {
                dp[i][j] += dp[i][j - 1];
            }
        }
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m - 1; j++) {
            if (a[i][j] != 'o' || a[i][j + 1] != 'o') {
                continue;
            }
            int len = dp[i][j] - 1;
            ans += val[len];
            ans %= mod;
        }
    }
    return ans;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    pow_[0] = 1;
    for (int i = 1; i < MAXN; i++) {
        pow_[i] = pow_[i - 1] * 2 % mod;
    }
    int n, m;
    cin >> n >> m;
    string kek;
    for (int i = 0; i < n; i++) {
        kek += ' ';
    }
    vector<string> a1(n), a2(m, kek);
    for (auto &el : a1) {
        cin >> el;
    }
    int W = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            W += a1[i][j] == 'o';
            a2[j][i] = a1[i][j];
        }
    }
    if (W >= 2) {
        val[0] = pow_[W - 2];
        if (W >= 3) {
            val[1] = pow_[W - 3];
        }
    }
    for (int i = 2; i + 2 <= W; i++) {
        if (i % 2 == 0) {
            val[i] = (val[i - 1] + pow_[W - 2 - i]) % mod;
        } else {
            val[i] = (val[i - 2] + pow_[W - 2 - i]) % mod;
        }
    }
    int ans = (sol(a1) + sol(a2)) % mod;
    cout << ans << '\n';
}