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:
#pragma region
#include <bits/stdc++.h>
#define endl '\n'
#define fastIO ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define prec fixed<<setprecision(9)
#define all(x) x.begin(),x.end()
using ll = long long;
using namespace std;
int mod = 998244353;

string to_string(string& s) {return '"'+s+'"';}
string to_string(bool& b) {return b?"true":"false";}
string to_string(const char* s) {string t; return to_string(t=s);}
template <class A, class B> string to_string(pair<A, B>& p) {return "("+to_string(p.first)+", "+to_string(p.second)+")";}
template <class A> string to_string(A& v) {string s; for (auto &x : v) s+=(s.empty()?"":", ")+to_string(x); return "{"+s+"}";}
template<class... Ts> void _debug(Ts&... args){(..., (cerr<<" "<<to_string(args))); cerr<<endl;}
#ifdef apurv
#define debug(args...) cerr<<__LINE__<<" ["<<#args<<"]:", _debug(args)
#else
#define debug(...) 42
#endif
#pragma endregion


long long binpow(long long a, long long b, long long m = mod) {
    // source : https://cp-algorithms.com/algebra/binary-exp.html
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
ll mminvprime(ll a, ll b) {return binpow(a, b - 2, b);}
ll mod_add(ll a, ll b, ll m) {a = a % m; b = b % m; return (((a + b) % m) + m) % m;}
ll mod_mul(ll a, ll b, ll m) {a = a % m; b = b % m; return (((a * b) % m) + m) % m;}
ll mod_div(ll a, ll b, ll m) {a = a % m; b = b % m; return (mod_mul(a, mminvprime(b, m), m) + m) % m;}  //only for prime m

int main()
{
    fastIO
    int n,m; cin>>n>>m;
    ll ans = 0;
    vector<vector<int>> arr(n,vector<int>(m));
    int tot = 0;
    for(int i=0;i<n;i++){
        string s; cin>>s;
        for(int j=0;j<m;j++){
            arr[i][j] = (s[j]=='o');
            tot+=(s[j]=='o');
        }
    }
    vector<vector<int>> row(n,vector<int>(m,-1)), col(n,vector<int>(m,-1));
    for(int i=0;i<n;i++){
        int last = m;
        for(int j=0;j<m;j++) {
            if(arr[i][j]==0) {last = m; continue;}
            last = min(last,j);
            row[i][j] = last;
        }
    }
    for(int j=0;j<m;j++){
        int last = n;
        for(int i=0;i<n;i++){
            if(arr[i][j]==0) {last = n; continue;}
            last = min(last,i);
            col[i][j] = last;
        }
    }
    // debug(row); debug(col);
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            if(arr[i][j]==0) continue;
            int last = row[i][j];
            int ln = j - last + 1;
            if(ln%2==0) {
                // ans+=binpow(2,tot-ln); ans%=mod;
                ans = mod_add(ans,binpow(2,tot-ln),mod);
                ln--;
            }   
            if(ln==1) continue;
            int a = tot - ln, b = tot - 3;
            assert(ln>=3); assert(a<=b);
            ll v = binpow(2,b-a+2) - 1;
            v = mod_div(v,3,mod); 
            // v*=binpow(2,a);
            v = mod_mul(v,binpow(2,a),mod);
            // v%=mod; 
            // ans+=v; ans%=mod;
            ans = mod_add(ans,v,mod);
        }
    }
    for(int j=0;j<m;j++){
        for(int i=0;i<n;i++){
            if(arr[i][j]==0) continue;
            int last = col[i][j];
            int ln = i - last + 1;
            if(ln%2==0) {
                // ans+=binpow(2,tot-ln); ans%=mod;
                ans = mod_add(ans,binpow(2,tot-ln),mod);
                ln--;
            }
            if(ln==1) continue;
            int a = tot - ln, b = tot - 3;
            assert(ln>=3); assert(a<=b);
            ll v = binpow(2,b-a+2) - 1;
            v = mod_div(v,3,mod); 
            // v*=binpow(2,a); v%=mod; ans+=v; ans%=mod;
            v = mod_mul(v,binpow(2,a),mod);
            ans = mod_add(ans,v,mod);
        }
    }
    cout<<ans<<endl;
}