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 int long long
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define pairii pair<int,int>
#define ff first
#define ss second
#define all(x) x.begin(),x.end()

const int NUM=1000030;
const int N = 10000000;
vector<int> lp, sieve;
vector<int> pr;
void primefactor();
int binpow(int a, int b);
int binpow(int a, int b, int mod);
int gcd(int a, int b);
int lcm (int a, int b);
bool comp(int a, int b);
int inversemod(int a, int mod);
void calc_sieve();

int mod1=998244353;
vector<int> fib(300005,0);


void test()
{
    int n,m,i,j;
    cin>>n>>m;
    vector<string> arr(n);
    for(i=0;i<n;i++) cin>>arr[i];

    int ans=0;
    int count=0;
    for(i=0;i<n;i++)
    {
        for(j=0;j<m;j++) if(arr[i][j]!='*') count++;
    }
    vector<vector<int> > dp(n, vector<int>(m,0)), dp1(n, vector<int>(m,0));
    for(i=0;i<n;i++) if(arr[i][0]!='*') dp[i][0]=1;
    for(j=0;j<m;j++) if(arr[0][j]!='*') dp1[0][j]=1;
    for(i=0;i<n;i++)
    {
        for(j=1;j<m;j++)
        {
            dp[i][j]=dp[i][j-1];
            if(arr[i][j]!='*') dp[i][j]++;
            else dp[i][j]=0;
        }
    }
    int last=0;
    for(i=0;i<n;i++)
    {
        last=0;
        for(j=m-1;j>=0;j--)
        {
            if(dp[i][j]>last) 
            {
                ans+=binpow(2, count-dp[i][j],mod1)*fib[dp[i][j]];
                ans%=mod1;
            }
            last=dp[i][j];
        }
    }
    // cout<<ans<<endl;
    // for(i=0;i<n;i++)
    // {
    //     for(j=0;j<m;j++) cout<<dp[i][j]<<" ";
    //     cout<<endl;
    // }
    for(j=0;j<m;j++)
    {
        for(i=1;i<n;i++)
        {
            dp1[i][j]=dp1[i-1][j];
            if(arr[i][j]!='*') dp1[i][j]++;
            else dp1[i][j]=0;
        }
    }

    for(j=0;j<m;j++)
    {
        last=0;
        for(i=n-1;i>=0;i--)
        {
            if(dp1[i][j]>last) 
            {
                ans+=binpow(2, count-dp1[i][j], mod1)*fib[dp1[i][j]];
                ans%=mod1;
            }
            last=dp1[i][j];
        }
    }
    // cout<<endl;
    // for(i=0;i<n;i++)
    // {
    //     for(j=0;j<m;j++) cout<<dp1[i][j]<<" ";
    //     cout<<endl;
    // }

    cout<<ans<<endl;

}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    fib[0]=0;
    fib[1]=0;
    for(int i=2;i<fib.size();i++) fib[i]=((fib[i-1]+2*fib[i-2])%mod1+binpow(2,i-2, mod1))%mod1;
    // for(int i=0;i<10;i++) cout<<fib[i]<<" ";
    // cout<<endl;
    int t=1;
    // cin>>t;
    while(t--) test();
    return 0;
}

void calc_sieve() //credits: Anish_Sofat
{
    sieve.resize(NUM+1,0);
    for (int x = 2; x <= NUM; x++)
        {
            if (sieve[x]) continue;
            for (int u = x; u <= NUM; u += x)
            {
                    sieve[u] = x ;
            }
        }
}

void primefactor()
{
    lp.resize(N+1,0);
    for (int i=2; i<=N; ++i) {
        if (lp[i] == 0) {
            lp[i] = i;
            pr.push_back (i);
        }
        for (int j=0; j<(int)pr.size() && pr[j]<=lp[i] && i*pr[j]<=N; ++j)
            lp[i * pr[j]] = pr[j];
    }
}

int binpow(int a, int b)
{
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

int binpow(int a, int b, int mod)
{
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = (res * a)%mod;
        a = (a * a)%mod;
        b >>= 1;
    }
    return res%mod;
}

int gcd(int a, int b)
{
    if(b==0) return a;
    else return gcd(b,a%b);
}

int lcm (int a, int b)
{
    return ((a / gcd(a, b)) * b);
}

bool comp(int a, int b)
{
    return a>b;
}

int inversemod(int a, int mod)
{
    return binpow(a,mod-2, mod);
}