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>

using namespace std;

template<int MOD>
struct Modular {
  int value;
  Modular(const Modular& k) : value(k.value) {}

  template<typename V>
    Modular(const V& v) : value(v % MOD) {
      if (value < 0) {
        value += MOD;
      }
    }

  Modular() : Modular(0) {}

  Modular& operator+=(Modular const& b) { value += b.value; if (value >= MOD) value -= MOD; return *this; } 
  Modular& operator-=(Modular const& b) { value -= b.value; if (value < 0) value += MOD; return *this; }
  Modular& operator*=(Modular const& b) { value = (long long)value * b.value % MOD; return *this; }
  Modular& operator++() { return *this += 1; }
  Modular& operator--() { return *this -= 1; }
  Modular operator++(int) { return *this += 1; }
  Modular operator--(int) { return *this -= 1; }

  friend Modular inverse(Modular a) { return mexp(a, MOD - 2); }
  Modular& operator/=(Modular const& b) { return *this *= inverse(b); }
  friend Modular operator+(Modular a, Modular const b) { return a += b; }
  friend Modular operator-(Modular a, Modular const b) { return a -= b; }
  friend Modular operator-(Modular const a) { return 0 - a; }
  friend Modular operator*(Modular a, Modular const b) { return a *= b; }
  friend Modular operator/(Modular a, Modular const b) { return a /= b; }
  friend std::ostream& operator<<(std::ostream& os, Modular const& a) { return os << a.value; }
  friend bool operator==(Modular const& a, Modular const& b) { return a.value == b.value; }
  friend bool operator!=(Modular const& a, Modular const& b) { return a.value != b.value; }
};

template <int T, typename V>
Modular<T> mexp(Modular<T> a, V e) {
  if (a == 0) return e == 0 ? 1 : 0; 
  Modular<T> res = 1; 
  while (e) { 
    if (e & 1) 
      res *= a; 
    a *= a; 
    e >>= 1; 
  }
  return res;
}

constexpr int MOD = 998244353;

const int N = 3.1e5 + 10;

using Mint = Modular<MOD>;

Mint p2[N];
Mint p2_inv[N];

void solve() {
  int n, m;
  cin >> n >> m;
  vector<vector<char>> a(n + 1, vector<char>(m + 1));
  vector<vector<char>> b(m + 1, vector<char>(n + 1)); 
  int w = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      cin >> a[i][j];
      b[j][i] = a[i][j];
      w += a[i][j] == 'o';
    }
  }
  p2[0] = 1;
  p2_inv[0] = 1;
  for (int i = 1; i < N; ++i) {
    p2[i] = p2[i - 1] + p2[i - 1];
    p2_inv[i] = inverse(p2[i]);
  }
  auto get = [&]() {
    Mint ans = 0;
    for (int i = 0; i < n; ++i) {
      int on_row = count(a[i].begin(), a[i].end(), 'o');
      Mint usable = Mint(on_row) / 2;
      Mint odds = 0;
      for (int j = 0; j < m; ) {
        if (a[i][j] != 'o') {
          ++j;
          continue;
        }
        int pt = j;
        while (pt < m && a[i][pt] == 'o')
          ++pt;
        int len = pt - j;
        for (int k = 1; k <= len; k += 2) {
          int segs = len - k + 1;
          if (k == len) {
            odds += p2_inv[len];
          } else {
            odds += (segs - 2) * p2_inv[k + 2];
            odds += 2 * p2_inv[k + 1];
          }
        }
        j = pt;
      }
      ans += p2_inv[1] * (usable - odds);
    }
    return ans;
  };
  Mint expec = 0;
  expec += get();
  a.swap(b);
  swap(n, m);
  expec += get();
  cout << expec * p2[w] << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}