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 ll  long long
#define int ll
#define vi vector<int>
#define pii pair<ll,ll>
#define piii pair<int, pii>
#define pb push_back
#define fs first
#define sc second
//#define ONLINE_JUDGE
#define endl "\n"
#define pow2(i) (1<<(i))  
#define d0(x) cout<<x<<" "
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<x<<" "<<y<<" "<<z<<endl
#define d4(x,y,z,w) cout<<x<<" "<<y<<" "<<z<<" "<<w<<endl
#define d5(x,y,z,w,s) cout<<x<<" "<<y<<" "<<z<<" "<<w<<" "<<s<<endl
#define fifo ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define precise(x) cout<<fixed<<setprecision(x)
#define all(v) (v).begin(),(v).end()
const ll mod =   998244353;


int dp[300001][3]; int cnt[300001]; int p[300001];int ans[300001];vi v[300001];
void solve()
{
	dp[0][0]=1;
	dp[0][1]=0;
	dp[0][2]=0;
	ans[0]=0;
	p[0]=1;
	for(int i=1;i<=300000;i++)
	{
		ans[i] = (2*ans[i-1]+dp[i-1][1])%mod;
		dp[i][1] = dp[i-1][0]+dp[i-1][2];
		dp[i][0] = dp[i-1][2]+dp[i-1][1]+dp[i-1][0];
		dp[i][2] = dp[i-1][1];

		for(int j=0;j<3;j++)
			dp[i][j]%=mod;

		p[i]= (p[i-1]*2)%mod;
	}

	int n,m;cin>>n>>m;
	for(int i=0;i<=n;i++)
		v[i].resize(m);
	for(int i=0;i<=n;i++)
		for(int j=0;j<=m;j++)
			v[i][j]=0;
	int tot = 0;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
		{
			char c;
			cin>>c;
			if(c=='o')
			{
				tot++;
				v[i][j]=1;
			}
		}

	/*for(int i=0;i<=n;i++)
		for(int j=0;j<=m;j++)
			cout<<v[i][j]<<(j==m?"\n":"");
*/
	int ret = 0;
	for(int i=0;i<=n;i++)
		for(int j=0;j<=m;j++)
		{
			if(v[i][j]==0)
			{
				int crr = 0;
				for(int k=j+1;k<=m;k++)
				{
					if(v[i][k]==0)break;
					crr++;
				}
				ret = (ret+ans[crr]*p[tot-crr])%mod;
				//if(crr>0)d3(i,j,crr);
				crr = 0;
				for(int k=i+1;k<=n;k++)
				{
					if(v[k][j]==0)break;
					crr++;
				}
				ret = (ret+ans[crr]*p[tot-crr])%mod;
				//if(crr>0)d3(i,j,crr);
			}
		}

	d1(ret);

}
 
 
signed main()
{
    #ifndef ONLINE_JUDGE
   freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif
 
    fifo
    int tt=1;
 
  // cin>>tt;
 	//d1(tt);
 	//d1(f00());
    for(ll tc=1;tc<=tt;++tc)
    {
    	//cout<<"Case #"<<tc<<": ";
        solve();
    }
}