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;
int read() {
	char c=getchar(); int x=0,f=1;
	while (c<'0' || c>'9') {
		if (c=='-') f=-1;
		c=getchar();
	}
	while (c>='0' && c<='9') {
		x=x*10+c-'0';
		c=getchar();
	}
	return x*f;
}
const int p=998244353;
int a[1200005],b[1200005],c[1200005],fac[1200005],inv[1200005]; 
int pow_3[1200005],inv_3[1200005],R[1200005];
void add(int &x,int y) {x+=y; if (x>=p) x-=p;}
int pow_mod(int x,int k) {
	int ans=1;
	while (k) {
		if (k&1) ans=1LL*ans*x%p;
		x=1LL*x*x%p;
		k>>=1; 
	}
	return ans;
}
void ntt(int *x,int n,int f) {
    pow_3[1]=pow_mod(3,(p-1)/n);
    if (f==1) {
        pow_3[0]=1; 
        for (int i=1; i<n; i++) pow_3[i]=1LL*pow_3[i-1]*pow_3[1]%p;
    }
    else {
        inv_3[0]=1; inv_3[1]=pow_mod(pow_3[1],p-2);
        for (int i=2; i<n; i++) inv_3[i]=1LL*inv_3[i-1]*inv_3[1]%p;
    }
    int t=0,tp=1;
    while (tp<n) tp<<=1,++t;
    for (int i=0; i<tp; i++) R[i]=(R[i>>1]>>1)|((i&1)?(tp>>1):0);
    for (int i=0; i<n; i++) if (i<R[i]) swap(x[i],x[R[i]]);
    for (int l=2; l<=n; l<<=1) {
        int m=l/2;
        for (int *y=x; y!=x+n; y+=l) {
            for (int j=0; j<m; j++) {
                int tmp;
                if (f==1) tmp=1LL*y[j+m]*pow_3[n/l*j]%p;
                else tmp=1LL*y[j+m]*inv_3[n/l*j]%p;
                y[j+m]=y[j]-tmp; if (y[j+m]<0) y[j+m]+=p; 
                y[j]+=tmp; if (y[j]>=p) y[j]-=p;
            }
        }
    }
    if (f==-1) {
        int tmp=pow_mod(n,p-2);
        for (int i=0; i<n; i++) x[i]=1LL*x[i]*tmp%p;
    }
}
int f[300005],tot;
vector<int> vec[300005];
char s[300005];
int calc(int x) {
	return 1LL*f[x+1]*pow_mod(2,tot-x)%p;
}
int main() {
	for (int i=0; i<=300001; i++) a[i]=i/2;
	for (int i=0; i<=300001; i++) b[i]=pow_mod(2,i);
	int N=1;
    while (N<=600000) N<<=1;
	ntt(a,N,1); ntt(b,N,1);
	for (int i=0; i<N; i++) c[i]=1LL*a[i]*b[i]%p;
	ntt(c,N,-1);
	f[0]=0;
	int sum=0;
	for (int i=1; i<=300001; i++) {
		f[i]=(i-1)/2;
		add(f[i],sum);
		if (i>=2) add(f[i],c[i-2]);
		add(sum,f[i]);
	}
	int n=read(),m=read(); tot=0;
	for (int i=0; i<n; i++) {
		scanf("%s", s);
		for (int j=0; j<m; j++) {
			vec[i].push_back((s[j]=='o')?1:-1);
			if (s[j]=='o') ++tot;
		}
	}
	int ans=0;
	for (int i=0; i<n; i++) {
		int cnt=0;
		for (int j=0; j<m; j++) {
			if (vec[i][j]==1) ++cnt;
			else {
				if (cnt>0) add(ans,calc(cnt));
				cnt=0;
			}
		}
		if (cnt>0) add(ans,calc(cnt));
	}
	for (int j=0; j<m; j++) {
		int cnt=0;
		for (int i=0; i<n; i++) {
			if (vec[i][j]==1) ++cnt;
			else {
				if (cnt>0) add(ans,calc(cnt));
				cnt=0;
			}
		}
		if (cnt>0) add(ans,calc(cnt));
	}
	printf("%d\n", ans);
	return 0;
}