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;
typedef long double ld;
typedef double db;

typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef pair<pii, int> piipi;
typedef pair<int, pii> pipii;
typedef pair<pii, pii> piipii;
typedef pair<ll, pii> plpii;
typedef pair<db, db> pdd;
typedef pair<ld, ld> pldd;

#define mp make_pair
#define fi first
#define se second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define eb emplace_back
#define pf push_front
#define pb push_back

// const int mod = 998244353;
const int P1 = 999983, P2 = 999979;
const ld PI = acos((ld)-1);
const int mod = 998244353;
const int dir[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
const ll INF = 1e18;
const int N = 1e6+5;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

char c[300005];
vector<char> s[300005];
vector<int> sumR[300005], sumL[300005], sumU[300005], sumD[300005];
ll dp1[300005], dp2[300005];
ll pw[300005];
int main(){
    int n, m;
    scanf("%d%d", &n, &m);
    pw[0] = 1;
    for(int i=1;i<=n*m;i++) pw[i] = pw[i-1]*2%mod;
    for(int i=0;i<=n+2;i++){
        s[i].resize(m+2);
        sumR[i].resize(m+2);
        sumL[i].resize(m+2);
        sumU[i].resize(m+2);
        sumD[i].resize(m+2);
    }
    int sum = 0;
    for(int i=1;i<=n;i++){
        scanf("%s", c+1);
        for(int j=1;j<=m;j++){
            s[i][j] = c[j];
            if(s[i][j] == 'o'){
                sum++;
                sumL[i][j] = sumL[i][j-1] + 1;
                sumU[i][j] = sumU[i-1][j] + 1;
            }
        }
    }

    for(int i=1;i<=n*m;i++){
        if(sum-i-2 >= 0){
            dp1[i] += (i/2)*1ll*pw[sum-i-2]%mod;
            dp1[i] += dp1[i-1];
            dp1[i] %= mod;
        }
        if(sum-i-1 >= 0){
            dp2[i] += (i/2)*1ll*pw[sum-i-1]%mod;
            dp2[i] += dp2[i-1];
            dp2[i] %= mod;
        }
    }

    for(int i=n;i>=1;i--){
        for(int j=m;j>=1;j--){
            if(s[i][j] == 'o'){
                sumR[i][j] = sumR[i][j+1] + 1;
                sumD[i][j] = sumD[i+1][j] + 1;
            }
        }
    }
    ll ans = 0;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(s[i][j] == 'o'){
                int cnt = sumL[i][j];
                if(j == m || s[i][j+1] != 'o'){
                    ans += dp2[cnt-1];
                    ans %= mod;
                    if(sum-cnt >= 0){
                        ans += (cnt/2)*1ll*pw[sum-cnt]%mod;
                        ans %= mod;
                    }
                }
                else{
                    ans += dp1[cnt-1];
                    ans %= mod;
                    if(sum-cnt-1 >= 0){
                        ans += (cnt/2)*1ll*pw[sum-cnt-1]%mod;
                        ans %= mod;
                    }
                }

                cnt = sumU[i][j];
                if(i == n || s[i+1][j] != 'o'){
                    ans += dp2[cnt-1];
                    ans %= mod;
                    if(sum-cnt >= 0){
                        ans += (cnt/2)*1ll*pw[sum-cnt]%mod;
                        ans %= mod;
                    }
                }
                else{
                    ans += dp1[cnt-1];
                    ans %= mod;
                    if(sum-cnt-1 >= 0){
                        ans += (cnt/2)*1ll*pw[sum-cnt-1]%mod;
                        ans %= mod;
                    }
                }
                ans %= mod;
            }
        }
    }
    printf("%lld\n", ans);
}