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

Solution:
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main
{
	PrintWriter out = new PrintWriter(System.out);
	BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer tok = new StringTokenizer("");
    String next() throws IOException {
        if (!tok.hasMoreTokens()) { tok = new StringTokenizer(in.readLine()); }
        return tok.nextToken();
    }
    int ni() throws IOException { return Integer.parseInt(next()); }
    long nl() throws IOException { return Long.parseLong(next()); }
    
    long mod=998244353;
    
    void solve() throws IOException {
        int n=ni(),m=ni();
        int[][]A=new int[n+2][m+2];
        long ct=0;
        for (int i=1;i<=n;i++) {
            String s=next();
            for (int j=1;j<=m;j++) {
                if (s.charAt(j-1)=='o') {
                    A[i][j]=1;
                    ct++;
                }
            }
        }
        
        long[][]N=new long[n+1][m+1];
        long[][]D=new long[n+1][m+1];
        long[][]P=new long[n+1][m+1];
        long[][]E=new long[n+1][m+1];
        
        long ways=modpow(2,ct);
        long ans=0;
        
        for (int i=1;i<=n;i++) {
            for (int j=1;j<=m;j++) {
                if (A[i][j]==0) continue;
                if (A[i-1][j]==1 && D[i-1][j]>0 && N[i-1][j]>0) {
                    long num=N[i-1][j];
                    long den=D[i-1][j]*2;
                    long ansinc=(ways*num)%mod;
                    ansinc=(ansinc*modpow(den,mod-2))%mod;
                    ans=(ans+ansinc)%mod;
                    N[i][j]=(D[i-1][j]-N[i-1][j]+mod)%mod;
                    D[i][j]=(D[i-1][j]*2)%mod;
                }
                else { N[i][j]=1; D[i][j]=2; }
                
                if (A[i][j-1]==1 && E[i][j-1]>0 && P[i][j-1]>0) {
                    long num=P[i][j-1];
                    long den=E[i][j-1]*2;
                    long ansinc=(ways*num)%mod;
                    ansinc=(ansinc*modpow(den,mod-2))%mod;
                    ans=(ans+ansinc)%mod;
                    P[i][j]=(E[i][j-1]-P[i][j-1]+mod)%mod;
                    E[i][j]=(E[i][j-1]*2)%mod;
                }
                else { P[i][j]=1; E[i][j]=2; }
            }
        }
        out.println(ans);
        out.flush();
    }
    
    int len(long p) {
        int r=0;
        while (p>0) { r++; p/=10; }
        return r;
    }
    
    int gcd(int a,int b) { return(b==0?a:gcd(b,a%b)); }
    long gcd(long a,long b) { return(b==0?a:gcd(b,a%b)); }
    long modpow(long a,long p) { long r=1; while(p>0) { if ((p&1)==1) r=(r*a)%mod; p>>=1; a=(a*a)%mod; } return r; }
    
    public static void main(String[] args) throws IOException {
        new Main().solve();
    }
}