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 <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

//#pragma GCC optimize("Ofast")
//#pragma GCC optimization("unroll-loops, no-stack-protector")
//#pragma GCC target("avx,avx2,fma")

long long mul_inv(long long a, long long b)
{
	long long b0 = b, t, q;
	long long x0 = 0, x1 = 1;
	if (b == 1) return 1;
	while (a > 1) {
		q = a / b;
		t = b, b = a % b, a = t;
		t = x0, x0 = x1 - q * x0, x1 = t;
	}
	if (x1 < 0) x1 += b0;
	return x1;
}

long long division(long long a, long long b, long long p) {		// (a / b) mod p = ((a mod p) * (b^(-1) mod p)) mod p
	long long ans, inv;
	inv = mul_inv(b, p);
	ans = ((a % p) * inv) % p;
	return ans;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);

	long long n, m, i, j, k, ct, MOD = 998244353, ans, MAXX = 300100, w;
	cin >> n >> m;
	vector<string> s(n);
	for (i = 0; i < n; i++) cin >> s[i];

	w = 0;
	for (i = 0; i < n; i++) {
		for (auto ch : s[i]) {
			if (ch == 'o') w++;
		}
	}

	vector<long long> f2(MAXX), v(MAXX);
	f2[0] = 1;
	for (i = 1; i < MAXX; i++) f2[i] = (2 * f2[i - 1]) % MOD;
	v[0] = division(1, 4, MOD);
	for (i = 1; i < MAXX - 10; i++) {
		if (i % 2 == 1) v[i] = (v[i - 1] + MOD * MOD - division(1, f2[i + 2], MOD)) % MOD;
		else v[i] = (v[i - 1] + division(1, f2[i + 2], MOD)) % MOD;
	}

	ans = 0;

	for (i = 0; i < n; i++) {
		ct = 0;
		for (j = 0; j < m - 1; j++) {
			if ((s[i][j] == 'o') && (s[i][j + 1] == 'o')) {
				ans += v[ct];
				//cout << "V " << i << " " << j << " - " << ct << "\n";
			}
			if (s[i][j] == 'o') ct++;
			else ct = 0;
		}
	}

	for (j = 0; j < m; j++) {
		ct = 0;
		for (i = 0; i < n - 1; i++) {
			if ((s[i][j] == 'o') && (s[i + 1][j] == 'o')) {
				ans += v[ct];
				//cout << "H " << i << " " << j << " - " << ct << "\n";
			}
			if (s[i][j] == 'o') ct++;
			else ct = 0;
		}
	}

	ans %= MOD;
	ans = (ans * f2[w] + MOD * MOD) % MOD;
	cout << ans << "\n";

	return 0;
}