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 ll long long
#define ls id << 1
#define rs id << 1 | 1
#define mem(array, value, size, type) memset(array, value, ((size) + 5) * sizeof(type))
#define memarray(array, value) memset(array, value, sizeof(array))
#define fillarray(array, value, begin, end) fill((array) + (begin), (array) + (end) + 1, value)
#define fillvector(v, value) fill((v).begin(), (v).end(), value)
#define pb(x) push_back(x)
#define st(x) (1LL << (x))
#define pii pair<int, int>
#define mp(a, b) make_pair((a), (b))
#define Flush fflush(stdout)
#define vecfirst (*vec.begin())
#define veclast (*vec.rbegin())
#define vecall(v) (v).begin(), (v).end()
#define vecupsort(v) (sort((v).begin(), (v).end()))
#define vecdownsort(v, type) (sort(vecall(v), greater<type>()))
#define veccmpsort(v, cmp) (sort(vecall(v), cmp))
using namespace std;
const int N = 500050;
const int inf = 0x3f3f3f3f;
const ll llinf = 0x3f3f3f3f3f3f3f3f;
const int mod = 998244353;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0);
clock_t TIME__START, TIME__END;
void program_end()
{
#ifdef ONLINE
    printf("\n\nTime used: %.6lf(s)\n", ((double)TIME__END - TIME__START) / 1000);
    system("pause");
#endif
}
ll ksm(ll a, ll b, int mod2 = mod)
{
    ll ret = 1;
    while (b)
    {
        if (b & 1)
            ret = ret * a % mod2;
        a = a * a % mod2;
        b >>= 1;
    }
    return ret;
}
int n, m, _2[N], _3[N], a[N], inv, w;
int add(int a, int b) { return a + b >= mod ? a + b - mod : a + b; }
int sub(int a, int b) { return a - b < 0 ? a - b + mod : a - b; }
int mul(int a, int b) { return 1ll * a * b % mod; }
string s[N];

inline void solve()
{
    // for (int len = 1; len <= 17; ++len)
    // {
    //     int sum = 0;
    //     for (int s = 0; s < st(len); ++s)
    //     {
    //         int cnt = 0;
    //         for (int i = 0; i < len - 1; ++i)
    //         {
    //             if (((s >> i) & 1) && ((s >> (i + 1)) & 1))
    //                 cnt++, i++;
    //         }
    //         sum += cnt;
    //     }
    //     cout << len << ' ' << sum << endl;
    // }
    _2[0] = 1;
    for (int i = 1; i < N; ++i)
        _2[i] = (_2[i - 1] * 2ll) % mod, _3[i] = 3ll * i % mod;
    inv = ksm(9, mod - 2);
    for (int i = 1; i < N; ++i)
    {
        if (i % 2)
            a[i] = mul(add(mul(add(3 * i, 1), _2[i]), 1), inv);
        else
            a[i] = mul(sub(mul(add(3 * i, 1), _2[i]), 1), inv);
    }
    scanf("%d%d", &n, &m);
    for (int i = 0; i < n; ++i)
        cin >> s[i];
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < m; ++j)
            w += (s[i][j] == 'o');
    ll ans = 0;
    for (int i = 0, cnt = 0; i < n; ++i, ans = add(ans, mul(a[max(0, cnt - 1)], _2[w - cnt])), cnt = 0)
    {
        for (int j = 0; j < m; ++j)
        {
            if (s[i][j] == 'o')
                cnt++;
            else
                ans = add(ans, mul(a[max(0, cnt - 1)], _2[w - cnt])), cnt = 0;
        }
    }
    for (int j = 0, cnt = 0; j < m; ++j, ans = add(ans, mul(a[max(0, cnt - 1)], _2[w - cnt])), cnt = 0)
        for (int i = 0; i < n; ++i)
        {
            if (s[i][j] == 'o')
                cnt++;
            else
                ans = add(ans, mul(a[max(0, cnt - 1)], _2[w - cnt])), cnt = 0;
        }
    cout << ans << '\n';
}

int main()
{
    TIME__START = clock();
    int Test = 1;
    // scanf("%d", &Test);
    while (Test--)
    {
        solve();
        // if (Test)
        //     putchar('\n');
    }
    TIME__END = clock();
    program_end();
    return 0;
}