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;
typedef long long ll;
#define all(x) (x).begin(), (x).end()
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<bool>> vvb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
void debugF(ostream &os) {os << endl;}
template <typename Head, typename... Tail>
void debugF(ostream &os, Head H, Tail... T) { os << " " << H; debugF(os, T...); }
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debugF(cerr, __VA_ARGS__)
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); os << (i>0 ? " ":"") << v[i++]); return os;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int mod = 998244353;

ll expMod(ll a, ll b, ll mod){
    ll ans = 1;
    while(b){
        if(b&1) ans = (ans*a)%mod;
        a = (a*a)%mod;
        b >>= 1;
    }
    return ans;
}

int calc(vector<string> &M, vi &dp2){
    int n = M.size(); int m = M[0].size();
    int i,j;
    int ans = 0;
    for(i=0;i<n;i++){
        int cc = 0;
        for(j=0;j<m;j++){
            if(M[i][j] == 'o'){
                cc++;
                if(j+1 >= m || M[i][j+1] != 'o'){
                    ans += dp2[cc-1];
                    ans %= mod;
                }
            }
            else 
                cc = 0;
        }
    }
    return ans;
}

void transpose(vector<string> &M){
    int n = M.size(); int m = M[0].size();
    vector<string> M2(m, string(n,'.'));
    int i,j;
    for(i=0;i<n;i++){
        for(j=0;j<m;j++){
            M2[j][i] = M[i][j];
        }
    }
    M = M2;
}

void solve(){
    int n, m, i, j;
    cin >> n >> m;
    vector<string> M(n);
    cin >> M;
    int nw = 0;
    for(i=0;i<n;i++){
        nw += count(all(M[i]), 'o');
    }
    if(nw < 2){
        cout << 0 << "\n";
        return;
    }

    int N = max(n,m);

    vi p2(nw+1);
    p2[0] = 1;
    for(i=1;i<=nw;i++){
        p2[i] = (p2[i-1]*2)%mod;
    }
    ll div4 = expMod(4, mod-2, mod);
    
    vi dp(N);
    vi dp2(N); //dp2[i] = dp[0] + ... + dp[i-1]
    dp[0] = p2[nw-2];
    dp2[0] = 0;
    for(i=1;i<N;i++){
        dp[i] = p2[nw-3];
        if(i-2 >= 0){
            dp[i] += (dp[i-2]*div4)%mod;
            dp[i] %= mod;  
        }
        dp2[i] = (dp2[i-1] + dp[i-1])%mod;
    }

    auto ans = calc(M, dp2);
    transpose(M);
    ans += calc(M, dp2);
    ans %= mod;
    cout << ans << "\n";
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int nt = 1;
    for(int tt=1;tt<=nt;tt++){
        solve();
    }
    return 0;
}