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 MOD 998244353

int inv[1000002];

void getinv(int n=1000000){
	inv[1]=1;
	for(int i=2;i<=n;++i){
		inv[i]=MOD-(1LL*(MOD/i)*inv[MOD%i])%MOD;
	}
}

struct mint{
	int val;
	mint(int val=0): val(val){}
	void operator=(const mint ot){
		val=ot.val;
	}
	mint operator+(const mint ot) const{
		return (val+ot.val)%MOD;
	}
	mint operator-(const mint ot) const{
		return (val+MOD-ot.val)%MOD;
	}
	mint operator*(const mint ot) const{
		return 1LL*val*ot.val%MOD;
	}
	mint operator/(const mint ot) const{
		return 1LL*val*inv[ot.val]%MOD;
	}
};


int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	getinv();
	int n, m;
	cin>>n>>m;
	int bnd=max(n, m);
	vector<mint> p(bnd+1, 0);
	p[0]=mint(1)/mint(2);
	for(int i=1;i<=bnd;++i){
		p[i]=p[i-1]/mint(2);
	}
	vector<mint> sp(bnd+1, 0);
	sp[0]=0;
	sp[1]=p[1];
	sp[2]=p[2];
	for(int i=3;i<=bnd;++i) sp[i]=p[i]+sp[i-2];
	vector<vector<char>> a(n+1, vector<char>(m+1));
	vector<vector<int>> lef(n+1, vector<int>(m+1));
	vector<vector<int>> up(n+1, vector<int>(m+1));
	mint ev(0);
	mint w(1);
	for(int i=1;i<=n;++i){
		for(int j=1;j<=m;++j){
			cin>>a[i][j];
			if(a[i][j]=='o'){
				lef[i][j]=1+lef[i][j-1];
				up[i][j]=1+up[i-1][j];

				mint pup;
				if(up[i][j]&1){
					//p[2]+p[4]+p[6]...p[up[i][j]-1];
					pup=sp[up[i][j]-1];
				}
				else{
					//p[2]+p[4]+p[6]+p[up[i][j]-2]+p[up[i][j]-1];
					pup=sp[up[i][j]-2]+p[up[i][j]-1];
				}
				ev=ev+pup;
				mint pl;
				if(lef[i][j]&1){
					//p[2]+p[4]+p[6]...p[up[i][j]-1];
					pl=sp[lef[i][j]-1];
				}
				else{
					//p[2]+p[4]+p[6]+p[up[i][j]-2]+p[up[i][j]-1];
					pl=sp[lef[i][j]-2]+p[lef[i][j]-1];
				}
				ev=ev+pl;
				w=w*mint(2);
			}
			else{
				lef[i][j]=up[i][j]=0;
			}
		}
	}
	cout<<(ev*w).val<<"\n";
	return 0;
}