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:
//By Harsh Mittal
//2018eeb1150@iitrpr.ac.in
#include<bits/stdc++.h>
using namespace std;
const double Epsilon = 4.94065645841247E-324;
long long int mod = 998244353;
const long double pi = 3.14159265358979323846;
typedef unsigned long long ul ;
typedef long long ll ;
typedef pair <ll, ll >  pii ;
typedef pair <ll, ll>  pll ;
typedef vector <int> vi ;
typedef vector <bool> vb ;
typedef vector <ll> vll ;
typedef vector <pii> vpi ;
typedef vector <pll> vpl ;
#define pb push_back
#define eb emplace_back

#define maxn 20000001



int main()
{
    ll three=3;
    mod = mod*three;
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t,n,m,j,k,d,p,u=1,v,ans,i,h,a,b,c=0,g,x1,x2,y1,y2,q,mid,xm,ym,x;
    cout.precision(25);
    //cin>>t;
    t=1;
    while(t--)
    {
        
        cin>>n>>m;
        string str[n];
        for(i=0;i<n;i++)
            cin>>str[i];

        p = max(n,m);

        ll arr[p+3];

        arr[0] = 0;
        arr[1] = 0;
        arr[2] = 1;
        arr[3] = 3;

        ll pow[n*m+1];
        pow[0] = 1;
        pow[1] = 2;
        pow[2] = 4;
        pow[3] = 8;
        for(i=4;i<=n*m;i++)
        {
            pow[i] = pow[i-1]*2;
            pow[i] = pow[i]%mod;
        }
        ans=0;
        ll total=0;
        for(i=0;i<n;i++)
        {
            for(j=0;j<m;j++)
            {
                if(str[i][j]=='o')
                    total++;
            }
        }

        for(i=4;i<=p;i++)
        {
            
            arr[i]=2*arr[i-1];
            if(i%2)
            {
                a = i/2;
                b = pow[2*a]-1;
                b=b/3;
                 
                arr[i] = arr[i]+b;
                arr[i] = arr[i]%mod;

            }
            else
            {
                a = i/2;
                a--;
                b = pow[2*a]-1;
                b=b/3;
                b=b*2;
                b++;
                arr[i] = arr[i]+b;
                arr[i] = arr[i]%mod;
            }
        }

        bool check = false;
        q=0;
        for(i=0;i<n;i++)
        {
            for(j=0;j<m;j++)
            {
                if(str[i][j]=='*')
                {
                    if(check)
                    {
                        x = arr[q]*pow[total-q];
                        x = x%mod;
                        ans = ans + x;
                        ans = ans%mod;
                        check = false;
                        q=0;
                    }

                }
                else
                {
                    if(check)
                    {
                        q++;
                    }
                    else
                    {
                        check = true;
                        q++;
                    }
                }
            }
            x = arr[q]*pow[total-q];
            x = x%mod;
            ans = ans + x;
            ans = ans%mod;
            check = false;
            q=0;
        }
        q=0;
        check=false;

        for(i=0;i<m;i++)
        {
            for(j=0;j<n;j++)
            {
                if(str[j][i]=='*')
                {
                    if(check)
                    {
                        x = arr[q]*pow[total-q];
                        x = x%mod;
                        ans = ans + x;
                        ans = ans%mod;
                        check = false;
                        q=0;
                    }

                }
                else
                {
                    if(check)
                    {
                        q++;
                    }
                    else
                    {
                        check = true;
                        q=1;
                    }
                }
            }
            x = arr[q]*pow[total-q];
            x = x%mod;
            ans = ans + x;
            ans = ans%mod;
            check = false;
            q=0;
        }

        ans= ans%(mod/3);

        //cout<<arr[5]<<" "<<total<<endl;
        cout<<ans<<endl;

        

    }
    return 0;
}