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.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class SolutionE extends Thread {
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                                            InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    private static final FastReader scanner = new FastReader();
    private static final PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        solve();
        out.close();
    }

    private static final int MODULO = 998_244_353;
    private static void solve() {
        int n = scanner.nextInt();
        int m = scanner.nextInt();

        long[] pow2 = new long[n * m + 1];
        pow2[0] = 1;
        for (int i = 1; i < pow2.length; i++) {
            pow2[i] = (pow2[i-1] * 2);
            if (pow2[i] >= MODULO) {
                pow2[i] -= MODULO;
            }
        }

        char[][] grid = new char[n][m];
        int w = 0;
        for (int i = 0; i < n; i++) {
            String s = scanner.next();
            grid[i] = s.toCharArray();
            for (char c: s.toCharArray()) {
                if (c == 'o') {
                    w++;
                }
            }
        }

        long amount = 0;
        for (int c = 0; c < m; c++) {
            int amountAboveWhite = 0;
            int minus = 2;
            long basis = 0;
            for (int r = 0; r < n-1; r++) {
                if (amountAboveWhite % 2 == 1) {
                    basis = (basis + pow2[w-minus]);
                    while (basis >= MODULO) {
                        basis -= MODULO;
                    }
                }
                if (grid[r][c] == 'o' && grid[r+1][c] == 'o') {
                    if (amountAboveWhite % 2 == 0) {
                        amount = amount + basis + pow2[w - minus];
                    } else {
                        amount = amount + basis;
                    }
                    while (amount >= MODULO) {
                        amount -= MODULO;
                    }
                } else if (grid[r][c] == '*') {
                    amountAboveWhite = 0;
                    minus = 2;
                    basis = 0;
                    continue;
                }
                amountAboveWhite++;
                minus++;
            }
        }

        for (int r = 0; r < n; r++) {
            int amountAboveWhite = 0;
            int minus = 2;
            long basis = 0;
            for (int c = 0; c < m-1; c++) {
                if (amountAboveWhite % 2 == 1) {
                    basis = (basis + pow2[w-minus]);
                    while (basis >= MODULO) {
                        basis -= MODULO;
                    }
                }
                if (grid[r][c] == 'o' && grid[r][c+1] == 'o') {
                    if (amountAboveWhite % 2 == 0) {
                        amount = amount + basis + pow2[w - minus];
                    } else {
                        amount = amount + basis;
                    }
                    while (amount >= MODULO) {
                        amount -= MODULO;
                    }
                } else if (grid[r][c] == '*') {
                    amountAboveWhite = 0;
                    minus = 2;
                    basis = 0;
                    continue;
                }
                amountAboveWhite++;
                minus++;
            }
        }

        out.println(amount);
    }

    //REMINDERS:
    //- CHECK FOR INTEGER-OVERFLOW BEFORE SUBMITTING

    //- CAN U BRUTEFORCE OVER SOMETHING, TO MAKE IT EASIER TO CALCULATE THE SOLUTION
}