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.io.*;
import java.math.*;
import java.text.*;

public class Main {
    static PrintWriter out;
    static Reader in;
    public static void main(String[] args) throws IOException {
        input_output();
        Main solver = new Main();
        solver.solve();
        out.close(); 
        out.flush(); 
    }

    static int INF = (int)1e9;
    static int MAXN = (int)5e5+5;
    static int mod = 998244353;
    static int q, t;
    static double pi = Math.PI;

    void solve() throws IOException{
    	int n = in.nextInt();
    	int m = in.nextInt();

    	int[][] arr = new int[n][m];
    	int[][] tmp = new int[m][n];
    	for (int i = 0; i < n; i++) {
    		String s = in.next();
    		for (int j = 0; j < m; j++) {
    			if (s.charAt(j)!='*') {
    				arr[i][j] = 1;
    				tmp[j][i] = 1;
    			}
    		}
    	}

    	pwr = new int[MAXN];
    	pwr[0] =1;
    	for (int i = 1; i < MAXN; i++) pwr[i] = (pwr[i-1]*2)%mod;

    	long ans = calc(arr, n, m);
    	ans = (ans+calc(tmp, m, n))%mod;

    	out.println(ans);
    }

    //<>

    static int[] pwr;
    static long inv3 = 748683265;

    static long calc(int[][] arr, int n, int m) {
    	long res = 0;
    	long[][] dp = new long[n][m];

    	long cntall = 0;
    	for (int i = 0; i < n; i++)
    		for (int j = 0; j < m; j++)
    			cntall += arr[i][j];

    	if (m <= 1) return 0;

    	long tmp = 0;
    	for (int i = 0; i < n; i++) {
    		int cntw = 0;
    		tmp = 0;
    		for (int j = 0; j < m; j++) {
    			cntw += arr[i][j];
    		}
    		if (arr[i][0]+arr[i][1]==2) {
    			dp[i][0] = pwr[cntw-2];
    			tmp = (tmp+dp[i][0])%mod;
    		}
    		for (int j = 1; j < m-1; j++) {
    			if (arr[i][j]+arr[i][j+1] != 2) continue;
    			if (j == 1) {
    				dp[i][j] = pwr[cntw-2-arr[i][0]];
    			} else {
    				if (arr[i][j-1] == 0) {
    					dp[i][j] = pwr[cntw-2];
    				} else {
	    				dp[i][j] = (dp[i][j-2]*inv3)%mod;
	    				dp[i][j] = (dp[i][j]+pwr[cntw-3])%mod;
	    			}
    			}
    			tmp = (tmp+dp[i][j])%mod;
    		}
    		tmp = (tmp*pwr[(int)cntall-cntw])%mod;
    		res = (res+tmp)%mod;
    	}
    	return res;
    }

    static class Reader {
 
        private InputStream mIs;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
    
        public Reader() {
            this(System.in);
        }
    
        public Reader(InputStream is) {
            mIs = is;
        }
    
        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
    
        }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = mIs.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }
    
        public String nextLine() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isEndOfLine(c));
            return res.toString();
        }
    
        public String next() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }
    
        double nextDouble()
        {
            return Double.parseDouble(next());
        }
    
        public long nextLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }
    
        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }
    
        public boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
    
        public boolean isEndOfLine(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }
 
    }
    static void input_output() throws IOException {
        File f = new File("in.txt");
        if(f.exists() && !f.isDirectory()) { 
            in = new Reader(new FileInputStream("in.txt"));
        } else in = new Reader();
        f = new File("out.txt");
        if(f.exists() && !f.isDirectory()) {
            out = new PrintWriter(new File("out.txt"));
        } else out = new PrintWriter(System.out);
    }
}