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 PYTHON3):

Solution:
import sys
from math import gcd

input = sys.stdin.readline

def rec1(a, i, p, z):
	if i == len(a):
		return z
	if a[i] == '*':
		return rec1(a, i+1, i, z)
	else:
		if p == i-2:
			return rec1(a, i+1, i, z+1)+rec1(a, i+1, i, z)
		else:
			return rec1(a, i+1, p, z)+rec1(a, i+1, i, z)

def rec(a, i, p, pp):
	if i == len(a):
		return 0
	if a[i] == '*':
		return rec(a, i+1, i, pp)
	else:
		if p == i-2:
			return rec(a, i+1, i, pp)+rec(a, i+1, i,pp)+pp[i+1]
		else:
			return rec(a, i+1, p, pp)+rec(a, i+1, i,pp)

def solve1(a):
	MOD = 998244353
	n = len(a)
	pp = [1]*(n+1)
	for i in range(n-1,-1,-1):
		pp[i] = (pp[i+1]*(2 if a[i]=='o' else 1)) % MOD
	#ans = rec(a, 0, -1, pp)
	dp = [[0,0] for i in range(n+1)]
	#for i in range(n-1,-1,-1):
	#	if a[i] == '*':
	#		for p in i-1, i-2:
	#			dp[i][i-p-1] = dp[i+1][(i+1)-i-1]
	#	else:
	#		for p in i-1, i-2:
	#			if p == i-2:
	#				dp[i][i-p-1] = dp[i+1][(i+1)-i-1] + dp[i+1][(i+1)-i-1] + pp[i+1]
	#			else:
	#				dp[i][i-p-1] = dp[i+1][(i+1)-p-1] + dp[i+1][(i+1)-i-1]
	#ans = dp[0][0-(-1)-1]
	for i in range(n-1,-1,-1):
		if a[i] == '*':
			dp[i][0] = dp[i+1][0]
			dp[i][1] = dp[i+1][0]
		else:
			dp[i][1] = (dp[i+1][0] + dp[i+1][0] + pp[i+1]) % MOD
			dp[i][0] = (dp[i+1][1] + dp[i+1][0]) % MOD
	ans = dp[0][0]
	#print(a, ans)
	return ans

def solve():
	n, m = map(int, input().split())
	a = [input().strip() for i in range(n)]
	total = 0
	for i in range(n):
		total += a[i].count('o')
	MOD = 998244353
	r = 0
	for i in range(n):
		r = (r + solve1(a[i])*pow(2,total-a[i].count('o'),MOD)) % MOD 
	s = [None] * n
	for i in range(m):
		for j in range(n):
			s[j] = a[j][i]
		r = (r + solve1(s)*pow(2,total-s.count('o'),MOD)) % MOD
	print(r)

solve()