#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define ll long long
#define ld long double
#define pii pair <int,int>
#define pll pair <ll,ll>
#define pil pair <int,ll>
#define pli pair <ll,int>
#define pss pair <short,short>
#define ull unsigned long long
#define pdd pair <ld,ld> 
#define pb push_back
#define mp make_pair
#define puu pair<ull,ull>
#define pvv pair<vector<int>, vector<int> >
#define _bp __builtin_popcount
#define ptt pair <pnode,pnode>
#define all(v) v.begin(),v.end()
#define en "\n"
void file()
{
    freopen("input.txt","r",stdin);
    freopen("f.txt","w",stdout);
}
void boos()
{
	ios_base :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}
//const long double pi = acos(-1);
const ll INF = (ll)1e9 + 7ll;
const ll INF1 = 998244353;
const ll INF2 = (ll)1e9 + 9ll;
const ll LLINF = (ll)1e18;
const ll INTmx = (ll)1e9;
const ld EPS = (ld)1e-15;
const int N = 3e5 + 100;
string a[N];
ll st[N],dp[N],dp1[N],dp2[N];
int main()
{
	boos();
	//file();
	int n,m;
	cin >> n >> m;
	int k = 0;
	for(int i = 1;i <= n;i++)
	{
		cin >> a[i];
		a[i] = "0" + a[i];
		for(int j = 1;j <= m;j++)
		{
			if(a[i][j] == 'o')k++;
		}
	}
	st[0] = 1;
	dp1[0] = 1;
	for(int i = 1;i <= k;i++)
	{
		st[i] = (st[i - 1] * 2ll) % INF1;
	}
	dp2[2] = 1;
	dp1[2] = 1;
	for(ll i = 3;i <= max(n,m);i++)
	{
		dp[i] = (dp[i - 2] + (st[i - 3] * (i - 2)) % INF1) % INF1;
		if(i % 2 == 0)dp1[i] = (dp1[i - 1] * 2ll + 1ll) % INF1;
		else dp1[i] = (dp1[i - 1] * 2ll) % INF1;
		dp2[i] = dp[i];
		dp2[i] = (dp2[i] + dp1[i]) % INF1;
	}
	//cout << dp2[3] << " " << k << " " << st[k - 2] << en;
	ll ans = 0;
	for(int i = 1;i <= n;i++)
	{
		int L = 1;
		for(int j = 1;j <= m;j++)
		{
			if(a[i][j] == '*')
			{
				if(L != j)
				{
					ans += (dp2[j - L] * st[k - (j - L)]) % INF1;
					//ans += (st[j - L - 2] * st[k - (j - L)]) % INF1;
					//cout << j - L << " ";
					ans %= INF1;
				}
				L = j + 1;
			}
		}
		if(L != m + 1)
		{
			ans += (dp2[m - L + 1] * st[k - (m - L + 1)]) % INF1;
			//ans += (st[m - L - 1] * st[k - (m - L + 1)]) % INF1;
			//cout << m - L + 1 << " ";
			ans %= INF1;
		}
	}
	//cout << dp[4] << en;
	for(int j = 1;j <= m;j++)
	{
		int L = 1;
		for(int i = 1;i <= n;i++)
		{
			if(a[i][j] == '*')
			{
				if(L != i)
				{
					ans += (dp2[i - L] * st[k - (i - L)]) % INF1;
					//ans += (st[i - L - 2] * st[k - (i - L)]) % INF1;
					//cout << i - L << " ";
					ans %= INF1;
				}
				L = i + 1;
			}
		}
		if(L != n + 1)
		{
			ans += (dp2[n - L + 1] * st[k - (n - L + 1)]) % INF1;
			//ans += (st[n - L - 1] * st[k - (n - L + 1)]) % INF1;
			//cout << n- L + 1 << " ";
			ans %= INF1;
		}
	}
	cout << ans;
}
### Prompt

In cpp, your task is to solve the following 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

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define ll long long
#define ld long double
#define pii pair <int,int>
#define pll pair <ll,ll>
#define pil pair <int,ll>
#define pli pair <ll,int>
#define pss pair <short,short>
#define ull unsigned long long
#define pdd pair <ld,ld> 
#define pb push_back
#define mp make_pair
#define puu pair<ull,ull>
#define pvv pair<vector<int>, vector<int> >
#define _bp __builtin_popcount
#define ptt pair <pnode,pnode>
#define all(v) v.begin(),v.end()
#define en "\n"
void file()
{
    freopen("input.txt","r",stdin);
    freopen("f.txt","w",stdout);
}
void boos()
{
	ios_base :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}
//const long double pi = acos(-1);
const ll INF = (ll)1e9 + 7ll;
const ll INF1 = 998244353;
const ll INF2 = (ll)1e9 + 9ll;
const ll LLINF = (ll)1e18;
const ll INTmx = (ll)1e9;
const ld EPS = (ld)1e-15;
const int N = 3e5 + 100;
string a[N];
ll st[N],dp[N],dp1[N],dp2[N];
int main()
{
	boos();
	//file();
	int n,m;
	cin >> n >> m;
	int k = 0;
	for(int i = 1;i <= n;i++)
	{
		cin >> a[i];
		a[i] = "0" + a[i];
		for(int j = 1;j <= m;j++)
		{
			if(a[i][j] == 'o')k++;
		}
	}
	st[0] = 1;
	dp1[0] = 1;
	for(int i = 1;i <= k;i++)
	{
		st[i] = (st[i - 1] * 2ll) % INF1;
	}
	dp2[2] = 1;
	dp1[2] = 1;
	for(ll i = 3;i <= max(n,m);i++)
	{
		dp[i] = (dp[i - 2] + (st[i - 3] * (i - 2)) % INF1) % INF1;
		if(i % 2 == 0)dp1[i] = (dp1[i - 1] * 2ll + 1ll) % INF1;
		else dp1[i] = (dp1[i - 1] * 2ll) % INF1;
		dp2[i] = dp[i];
		dp2[i] = (dp2[i] + dp1[i]) % INF1;
	}
	//cout << dp2[3] << " " << k << " " << st[k - 2] << en;
	ll ans = 0;
	for(int i = 1;i <= n;i++)
	{
		int L = 1;
		for(int j = 1;j <= m;j++)
		{
			if(a[i][j] == '*')
			{
				if(L != j)
				{
					ans += (dp2[j - L] * st[k - (j - L)]) % INF1;
					//ans += (st[j - L - 2] * st[k - (j - L)]) % INF1;
					//cout << j - L << " ";
					ans %= INF1;
				}
				L = j + 1;
			}
		}
		if(L != m + 1)
		{
			ans += (dp2[m - L + 1] * st[k - (m - L + 1)]) % INF1;
			//ans += (st[m - L - 1] * st[k - (m - L + 1)]) % INF1;
			//cout << m - L + 1 << " ";
			ans %= INF1;
		}
	}
	//cout << dp[4] << en;
	for(int j = 1;j <= m;j++)
	{
		int L = 1;
		for(int i = 1;i <= n;i++)
		{
			if(a[i][j] == '*')
			{
				if(L != i)
				{
					ans += (dp2[i - L] * st[k - (i - L)]) % INF1;
					//ans += (st[i - L - 2] * st[k - (i - L)]) % INF1;
					//cout << i - L << " ";
					ans %= INF1;
				}
				L = i + 1;
			}
		}
		if(L != n + 1)
		{
			ans += (dp2[n - L + 1] * st[k - (n - L + 1)]) % INF1;
			//ans += (st[n - L - 1] * st[k - (n - L + 1)]) % INF1;
			//cout << n- L + 1 << " ";
			ans %= INF1;
		}
	}
	cout << ans;
}
```