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   fi(a,b) for(int i=a;i<b;i++)
#define   fj(a,b) for(int j=a;j<b;j++)
#define   ff first
#define   ss second
#define   ll long long
#define   ld long double
#define   ull unsigned long long
#define   bp(x) __builtin_popcount(x)
#define   pr(x) for(auto it: x) cout<<it<<" "; cout<<endl;
#define   getMax(x) max_element(x.begin(),x.end())
#define   getMin(x) min_element(x.begin(),x.end())
#define   endl "\n"
typedef   vector<int> vi;
typedef   vector< pair<int,int> > vii;
typedef   vector<long long> vl;
typedef   pair<int,int> pii;
typedef   pair<ll,ll> pll;
typedef   vector< pair<ll,ll> > vll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
// int dx[]={-1,0,1,1,1,0,-1,-1};
// int dy[]={-1,-1,-1,0,1,1,1,0};

const int MOD = 998244353;

long long power(long long x, long long y) { 
    long long res = 1;
    x = x % MOD;
    while (y > 0) { 
        if (y & 1) 
            res = (res*x) % MOD; 
        y = y>>1;
        x = (x*x) % MOD; 
    } 
    return res; 
}

long long modInverse(ll x){
  return power(x, MOD-2);
}

long long modAdd(long long a, long long b){
  return (a%MOD + b%MOD + 2*MOD)%MOD;
}

long long modMult(long long a,long long b){
  return (a%MOD * b%MOD) % MOD;
}

long long modDiv(long long a,long long b){
  return (a%MOD * modInverse(b)) % MOD;
}


void nikal_pehli_fursat_mai(){
    ll n, m;
    cin>>n>>m;
    vector<string>v(n);
    
    ll tot = 0, ans = 0;
    fi(0, n) {
        cin>>v[i];
        fj(0, m){
            if(v[i][j]=='o') tot++;
        }
    }
    
    vl cache(3e5+10);
    vector<array<pll, 3>>dp(3e5+10);
    dp[1][0].ff = 1;
    dp[1][1].ff = 1;
    fi(1, dp.size()-1){
    	dp[i+1][0].ff = modAdd(dp[i][1].ff + dp[i][0].ff, dp[i][2].ff);
    	dp[i+1][1].ff = modAdd(dp[i][0].ff, dp[i][2].ff);
    	dp[i+1][2].ff = dp[i][1].ff;

    	dp[i+1][0].ss = modAdd(dp[i][1].ss + dp[i][0].ss, dp[i][2].ss);
    	dp[i+1][1].ss = modAdd(dp[i][0].ss, dp[i][2].ss);
    	dp[i+1][2].ss = modAdd(dp[i][1].ss, dp[i][1].ff);
    }
    fi(2, dp.size()){
    	cache[i] = modAdd(dp[i][0].ss+dp[i][1].ss, dp[i][2].ss);
    }

    // cout<<cache[2]<<endl;
    
    fi(0, n){
        ll cnt = 0;
        fj(0, m){
            if(v[i][j]=='o') cnt++;
            else { 
                ans = modAdd(ans, modMult(power(2, tot-cnt), cache[cnt]));
                cnt = 0;
            }
        }
        ans = modAdd(ans, modMult(power(2, tot-cnt), cache[cnt]));
    } 

    fj(0, m){
        ll cnt = 0;
        fi(0, n){
            if(v[i][j]=='o') cnt++; 
            else { 
                ans = modAdd(ans, modMult(power(2, tot-cnt), cache[cnt]));
                cnt = 0;
            }
        }
        ans = modAdd(ans, modMult(power(2, tot-cnt), cache[cnt]));
    } 
    cout<<ans<<endl;
    // cout<<modMult(ans, power(2, tot))<<endl;

}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int tc=1; 
    // cin>>tc;
    while(tc--){
    nikal_pehli_fursat_mai();
    }
}