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>
#define INF (ll)(1e18 + 7)
#define MD (ll)(1e9 + 7)

using namespace std;
using ll = long long;
using cd = complex<double>;
using ul = unsigned long;

const ll MAX  = 3e5 + 5;
const ll MOD = 998244353;
void f_io () { ios_base :: sync_with_stdio (false);
 cin.tie (nullptr);
 cout.tie (nullptr);
}

const ll N = 10000000;

ll mult (ll a, ll b) {
	return (a * 1LL * b) % MOD;
}

ll add (ll a, ll b)  {
	b = ((b % MOD + MOD) % MOD);
	return (a + b) % MOD;
}

ll pw (ll a, ll b) {
	ll r = 1;
	while (b) {
		if (b & 1) {
			r = mult (a, r);
		}
		b >>= 1;
		a = mult (a, a);
	}
	return r;
}
ll gc (ll a, ll y) {	
	if (!a || !y) {
		return max (a, y);
	}
	ll r = a % y;
	while (r) {
		a = y;
		
		r = a % y;
	}
	return y;
}

ll extended_gcd (ll x, ll y) {
	ll ax = 1, ay = 0, bx = 0, by = 1;
	ll r = (x % y);
	while (r) {
		ll a1, a2, b1, b2;
		a1 = bx, a2 = by;
		ll q = (x / y);
		b1 = ax - q * bx, b2 = ay - q * by;
		ax = a1, ay = a2, bx = b1, by = b2;
		x = y;
		y = r;
		r = x % y;
	}
	return bx;
}

ll dp[MAX][2], d2[MAX][2];

int main () {
	ll n, m;
	cin >> n >> m;
	dp[0][0] = 1;
	for (ll i = 0; i + 1 < MAX; i++) {
		for (ll j = 0; j < 2; j++) {
			dp[i + 1][0] = add (dp[i][j], dp[i + 1][0]);
			d2[i + 1][0] = add (d2[i][j], d2[i + 1][0]);
			if (i + 2 < MAX && j == 0) {
				dp[i + 2][j] = add (dp[i + 2][j], dp[i][j]);
				d2[i + 2][j] = add (d2[i + 2][j], add (d2[i][j], dp[i][j]));
			}
		}
		dp[i + 1][1] = add (dp[i + 1][1], dp[i][0]);
		d2[i + 1][1] = add (d2[i + 1][1], d2[i][0]);
	}
	string vs[n + 1];
	string s;
	for (ll i = 0; i < m; s += '*', i++);
	ll cc = 0;
	for (ll i = 0; i < n; i++) {
		cin >> vs[i];
		vs[i] += '*';
		for (auto x : vs[i]) {
			cc += x == 'o';
		}
	}
	vs[n] = s;
	ll ans = 0;
	for (ll i = 0; i < n; i++) {
		ll c = 0;
		for (ll j = 0; j <= m; j++) {
			if (vs[i][j] == '*') {
				ans = add (mult (d2[c][0] + d2[c][1], pw (2, cc - c)), ans);
				c = 0;
			}
			else {
				c++;
			}
		}
	}
	for (ll j = 0; j < m; j++) {
		ll c = 0;
		for (ll i = 0; i <= n; i++) {
			if (vs[i][j] == '*') {
				ans = add (mult (d2[c][0] + d2[c][1], pw (2, cc - c)), ans);
				c = 0;
			}
			else {
				c++;
			}
		}
	}
	cout << ans << "\n";
}