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;

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef pair<int,int> Pair;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define EXIST(m,v) (m).find((v)) != (m).end()
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

constexpr double EPS = 1e-9;
constexpr double PI  = 3.1415926535897932;
constexpr int INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007; // 998244353;

template<class T> inline bool chmax(T& a, T b){if(a<b){a=b;return true;}return false;}
template<class T> inline bool chmin(T& a, T b){if(a>b){a=b;return true;}return false;}

template<long long mod=1000000007>
struct modint {
    long long x;
    modint(long long x=0):x((x%mod+mod)%mod){}
    long long val(){
        return x;
    }
    modint<mod> operator-() const { return modint(-x);}
    modint<mod>& operator+=(const modint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    modint<mod>& operator-=(const modint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
    	return *this;
    }
    modint<mod>& operator*=(const modint a) {
    	(x *= a.x) %= mod;
        return *this;
    }
    modint<mod> operator+(const modint a) const {
        modint<mod> res(*this);
        return res+=a;
    }
    modint<mod> operator-(const modint a) const {
        modint<mod> res(*this);
        return res-=a;
    }
    modint<mod> operator*(const modint a) const {
        modint<mod> res(*this);
        return res*=a;
    }
    modint<mod> pow(long long t) const {
        if (!t) return 1;
        modint<mod> a = pow(t>>1);
        a *= a;
    	if (t&1) a *= *this;
        return a;
    }

	// must be gcd(x,mod)==1
    modint<mod> inv() const {
		// a^{-1} = 1/a mod p (拡張Euclidの互除法)
		long long b = mod, u = 1, v = 0, z = x;
		while(b){
			long long t = z / b;
			z -= t * b; swap(z, b);
			u -= t * v; swap(u, v);
		}
		u %= mod;
		if (u < 0) u += mod;
		return modint<mod>(u);
	}

    //modint inv() const {
    //    return pow(mod-2);
    //}

    modint<mod>& operator/=(const modint a) {
    	return (*this) *= a.inv();
    }
    modint<mod> operator/(const modint a) const {
        modint<mod> res(*this);
        return res/=a;
    }
};
using mint = modint<998244353>;
mint inv34 = mint(4)/3, inv2 = mint(1)/2, inv4 = inv2*inv2;
vector<mint> p2(300300,1),p2inv(300300,1),p4inv(300300,1);

int n,m,w=0;
vector<string> s;
VVI lll,rrr;
mint ans(0);

mint f2(int n){
    return (mint(1) - p2inv[n+1])*2;
}

mint f4(int n){
    return inv34 * (mint(1)-p4inv[n+1]);
}

void solve(){
    REP(i,n)REP(j,m-1){
        if(s[i][j]=='*' || s[i][j+1]=='*') continue;

        int l = j - lll[i][j]-1, r = rrr[i][j+1] - (j+1)-1;

        if(l%2 == 0){
            ans += p2[w-l-3]*f2(r-1);
            ans += p2[w-l-r-2];
        }
        if(l) ans += p2[w-r-3]*f4((l-1)/2);

        if(l) ans += p2[w-4] * f4((l-1)/2) * f2(r-1);
    }
}

void g(){
    lll = VVI(n,VI(m,-1)); rrr = VVI(n,VI(m,m));

    REP(i,n){
        int pos = -1;
        REP(j,m){
            if(s[i][j] == '*') pos = j;
            lll[i][j] = pos;
        }

        pos = m;
        RREP(j,m){
            if(s[i][j] == '*') pos = j;
            rrr[i][j] = pos;
        }
    }

    return;
}

vector<string> trans(vector<string> t){
    int h = t.size(), w = t[0].size();
    vector<string> ret(w,string(h,'*'));
    REP(i,h)REP(j,w) ret[j][i] = t[i][j];
    return ret;
}

void Main(){
    cin >> n >> m;
    REP(i,n*m) p2inv[i+1] = p2inv[i]*inv2;
    REP(i,n*m) p2[i+1] = p2[i]*2;
    REP(i,n*m) p4inv[i+1] = p4inv[i] * inv4;

    s.resize(n,string(m,'*'));

    REP(i,n)REP(j,m){
        char c; cin >> c;
        s[i][j] = c;
        if(c == 'o') w++;
    }

    g(); solve();

    s = trans(s); swap(n,m);

    g(); solve();

    cout << ans.x << en;

    return;
}

int main(void){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);cout<<fixed<<setprecision(15);
    int t=1; //cin>>t;
    while(t--) Main();
    return 0;
}