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:


// after seeing discussions nice DP 10/10

/* dont stick to an approach */
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <algorithm>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <vector>
#include <numeric>
#include <cstdlib>

using namespace std;

typedef long long ll;
typedef unsigned long long int ull;
typedef long double ldb;

#define PB push_back

#define For(i, n) for (ll i = 0; i < n; i++)

#define trav(a,x) for (auto& a : x)

#define PYES cout<<"YES\n"
#define PNO cout<<"NO\n"
#define PYes cout<<"Yes\n"
#define PNo cout<<"No\n"
#define endl '\n'

#define sq(x)           (x*x)

#define vll             vector<ll>
#define rev(v)          reverse(v.begin(),v.end())
#define srt(v)          sort(v.begin(),v.end())
#define grtsrt(v)       sort(v.begin(),v.end(),greater<int>())
#define mnv(v)          *min_element(v.begin(),v.end())
#define mxv(v)          *max_element(v.begin(),v.end())
#define all(v)          v.begin(),v.end()

#define Fas ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)

//--------------------------------------------functions-------------------------------------------------//

ll power(ll a,ll b){ll result=1;while(b>0){if(b%2 == 1){result *= a;} a *= a;b /= 2;}return result;}
//ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
ll countSetBits(ll x){ll Count=0;while(x>0){if(x&1) Count++;x=x>>1;}return Count;}
bool isPerfectSquare(ll n){ll sr = sqrt(n);if (sr * sr == n)return true;else return false;}
ll mod(ll x,ll M){return ((x%M + M)%M);}
ll add(ll a, ll b,ll M){return mod(mod(a,M)+mod(b,M),M);}
ll mul(ll a, ll b,ll M){return mod(mod(a,M)*mod(b,M),M);}
ll powerM(ll a,ll b,ll M){
    ll res=1;
    while(b){
        if(b%2==1){
            res=mul(a,res,M);
        }
        a=mul(a,a,M);b/=2;
    }
    return res;
}
//------------------------------------sieve of erantothenes-----------------------------------------------//
//ll MAXN=1e7+100;
//vector<ll> fact(MAXN);
//void sieve_of_erantothenes()
//{
//    fact[1] = 1;
//    for (ll i = 2; i <= MAXN; i++)
//        fact[i] = i;
//    for (ll i = 4; i <= MAXN; i += 2)
//        fact[i] = 2;
//    for (ll i = 3; i * i <= MAXN; i++){
//        if (fact[i] == i){
//            for (ll j = i * i; j <= MAXN; j += i)
//                if (fact[j] == j)
//                    fact[j] = i;
//        }
//    }
//}
//----------------------------------------nCr mod------------------------------------------------------//
ll modInverse(ll n,ll M){
    return powerM(n,M-2,M);
}
ll nCrM(ll n,ll r,ll M){
    if(n<r) return 0;
    if(r==0) return 1;
    vector<ll> fact(n+1);
    fact[0]=1;
    for(ll i=1;i<=n;i++){
        fact[i]=mul(fact[i-1],i,M);
    }
    return mul(mul(fact[n],modInverse(fact[r],M),M),modInverse(fact[n-r],M),M);
}
//-----------------------------------------------solve-----------------------------------------------------//
ll maxxn=(3*(1e5))+7;
ll M=998244353;
vll sto(maxxn);

void precalc(){
    sto[0]=0;
    sto[1]=0;
    sto[2]=1;
    for(ll i=3;i<maxxn;i++){
        sto[i]=add(add(sto[i-1],mul(2,sto[i-2],M),M),powerM(2,i-2,M),M);
    }
}

void solve(){
    ll n,m;cin>>n>>m;
    vector<string> vv(n);
    ll cnt=0;
    for(ll i=0;i<n;i++){
        cin>>vv[i];
        for(ll j=0;j<m;j++){
            if(vv[i][j]!='*'){
                cnt++;
            }
        }
    }
    vll ans;
    for(ll i=0;i<n;i++){
        ll curr=0;
        for(ll j=1;j<m;j++){
            if(vv[i][j]!=vv[i][j-1] && vv[i][j]=='*'){
                if(j-curr!=1){
                    ans.PB(j-curr);
                    curr=j;
                }
            }else if(vv[i][j]!=vv[i][j-1] ){
                curr=j;
            }
        }
        if(vv[i][m-1]=='o' && m-curr!=1){
            ans.PB(m-curr);
        }
    }
    for(ll i=0;i<m;i++){
        ll curr=0;
        for(ll j=1;j<n;j++){
            if(vv[j-1][i]!=vv[j][i] && vv[j][i]=='*'){
                if(j-curr!=1){
                    ans.PB(j-curr);
                    curr=j;
                }
            }else if(vv[j-1][i]!=vv[j][i] ){
                curr=j;
            }
        }
        if(vv[n-1][i]=='o' && n-curr!=1){
            ans.PB(n-curr);
        }
    }
    ll fans=0;
    for(ll i=0;i<ans.size();i++){
        fans=add(fans,mul(sto[ans[i]],powerM(2,cnt-ans[i],M),M),M);
    }
    cout<<fans<<endl;
}

int main(){
    Fas;

//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
    
//    ll t=0;
//    cin>>t;
//    while(t--)
        precalc();
        solve();

    return 0;
}