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>

#define ed end()
#define bg begin()
#define mp make_pair
#define pb push_back
#define all(x) x.bg,x.ed
#define newline puts("")
#define si(x) ((int)x.size())
#define rep(i,n) for(int i=1;i<=n;++i)
#define rrep(i,n) for(int i=0;i<n;++i)
#define srep(i,s,t) for(int i=s;i<=t;++i)
#define drep(i,s,t) for(int i=t;i>=s;--i)

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int Maxn = 3e5+10;
const int Inf = 0x7f7f7f7f;
const ll Inf_ll = 1ll*Inf*Inf;
const int Mod = 998244353;
const double eps = 1e-7;

#define DEBUG
#define d1(x) std::cout << #x " = " << (x) << std::endl
#define d2(x, y) std::cout << #x " = " << (x) << " ," #y " = " << (y) << std::endl
#define disp(arry, fr, to) \
    { \
        std::cout << #arry " : "; \
        for(int _i = fr; _i <= to; _i++) std::cout << arry[_i] << " "; \
        std::cout << std::endl; \
    }


int n, m;
int *a[Maxn];
char s[Maxn];

ll mypow(ll a,ll b){
    ll inv = 1;
    while( b > 0 ){
        if( b&1 )  inv = inv*a%Mod;
        a = a*a%Mod;
        b >>= 1;
    }
    return inv;
}

ll inv[Maxn],fac[Maxn],finv[Maxn];
void Init(int n){
    inv[0] = inv[1] = fac[0] = finv[0] = 1;
    for(int i=2;i<=n;i++)
        inv[i] = 1ll*(Mod - Mod/i)*inv[Mod%i]%Mod;
    for(int i=1;i<=n;i++)
        fac[i] = fac[i-1]*i%Mod,
        finv[i] = finv[i-1]*inv[i]%Mod;
}

ll C(int n, int m){
    return fac[n]*finv[m]%Mod*finv[n-m]%Mod;
}

int main(){
    scanf("%d %d",&n,&m);
    for(int i=1;i<=n;i++)  a[i] = new int[m+10];
    int Sum = 0;
    for(int i=1;i<=n;i++)
    {
        scanf("%s",s+1);
        for(int j=1;j<=m;j++)  a[i][j] = (s[j] == 'o'), Sum += a[i][j];
    }
    ll ans = 0;
    // cout<<233<<endl;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            if( a[i][j] != 1 )  continue;
            int k = j, cnt = 1;
            while( k+1 <= m && a[i][k+1] == a[i][j] )  k++, cnt++;
            j = k;
            ans = (ans + 1ll*(cnt/2)*mypow(2, Sum-cnt))%Mod;
            for(int kk=3;kk<=cnt;kk++)
                ans = (ans + 2ll*((kk-1)/2)*mypow(2, Sum-kk))%Mod;
            for(int kk=4;kk<=cnt;kk++)
                ans = (ans + 1ll*((kk-2)/2)*mypow(2, Sum-kk)%Mod*(cnt-kk+1))%Mod;
        }
    }
    // d1(ans);    
    for(int j=1;j<=m;j++)
    {
        for(int i=1;i<=n;i++)
        {
            if( a[i][j] != 1 )  continue;
            int k = i, cnt = 1;
            while( k+1 <= n && a[k+1][j] == a[i][j] )  k++, cnt++;
            i = k;
            ans = (ans + 1ll*(cnt/2)*mypow(2, Sum-cnt))%Mod;
            for(int kk=3;kk<=cnt;kk++)
                ans = (ans + 2ll*((kk-1)/2)*mypow(2, Sum-kk))%Mod;
            for(int kk=4;kk<=cnt;kk++)
                ans = (ans + 1ll*((kk-2)/2)*mypow(2, Sum-kk)%Mod*(cnt-kk+1))%Mod;
        }
    }
    printf("%lld\n", ans);
    return 0;
}