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.*;
import java.util.*;

public class Main{
	static long[][]memo;
	static int mod=998244353;
	static long dp(int prev,int len) {
		if(len==0)return 0;
		if(memo[prev][len]!=-1)return memo[prev][len];
		if(prev==1) {//i can be colored
			return memo[prev][len]=(pow2[len-1]+dp(0, len-1)*2l)%mod;
		}
		return memo[prev][len]=(dp(1, len-1)+dp(0, len-1))%mod;
	}
	static long[]pow2;
	static void main() throws Exception{
		int n=sc.nextInt(),m=sc.nextInt();
		char[][]in=new char[n][];
		memo=new long[2][Math.max(n, m)+1];
		for(int i=0;i<2;i++) {
			Arrays.fill(memo[i], -1);
		}
		int white=0;
		for(int i=0;i<n;i++) {
			in[i]=sc.nextLine().toCharArray();
			for(int j=0;j<m;j++) {
				white+=in[i][j]=='o'?1:0;
			}
		}
		pow2=new long[n*m+1];
		pow2[0]=1;
		for(int i=1;i<pow2.length;i++) {
			pow2[i]=(pow2[i-1]*2)%mod;
		}
		long ans=0;
		for(int i=0;i<n;i++) {
			int j=0;
			while(j<m) {
				if(in[i][j]!='o') {
					j++;
					continue;
				}
				int cnt=0;
				while(j<m && in[i][j]=='o') {
					cnt++;
					j++;
				}
				long cur=(dp(0, cnt)*pow2[white-cnt])%mod;
				ans=(ans+cur)%mod;
			}
		}
		for(int j=0;j<m;j++) {
			int i=0;
			while(i<n) {
				if(in[i][j]!='o') {
					i++;
					continue;
				}
				int cnt=0;
				while(i<n && in[i][j]=='o') {
					cnt++;
					i++;
				}
				long cur=(dp(0, cnt)*pow2[white-cnt])%mod;
				ans=(ans+cur)%mod;
			}
		}
		pw.println(ans);
    }
    public static void main(String[] args) throws Exception{
    	sc=new MScanner(System.in);
    	pw = new PrintWriter(System.out);
        int tc=1;
//        tc=sc.nextInt();
        for(int i=1;i<=tc;i++) {
//            pw.printf("Case #%d:", i);
            main();
        }
        pw.flush();
    }
    static PrintWriter pw;
    static MScanner sc;
    static class MScanner {
        StringTokenizer st;
        BufferedReader br;
        public MScanner(InputStream system) {
            br = new BufferedReader(new InputStreamReader(system));
        }
     
        public MScanner(String file) throws Exception {
            br = new BufferedReader(new FileReader(file));
        }
     
        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }
        public int[] intArr(int n) throws IOException {
            int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();
            return in;
        }
        public long[] longArr(int n) throws IOException {
            long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();
            return in;
        }
        public int[] intSortedArr(int n) throws IOException {
            int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();
            shuffle(in);
            Arrays.sort(in);
            return in;
        }
        public long[] longSortedArr(int n) throws IOException {
            long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();
            shuffle(in);
            Arrays.sort(in);
            return in;
        }
        public Integer[] IntegerArr(int n) throws IOException {
            Integer[]in=new Integer[n];for(int i=0;i<n;i++)in[i]=nextInt();
            return in;
        }
        public Long[] LongArr(int n) throws IOException {
            Long[]in=new Long[n];for(int i=0;i<n;i++)in[i]=nextLong();
            return in;
        }
        public String nextLine() throws IOException {
            return br.readLine();
        }
     
        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }
     
        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }
     
        public char nextChar() throws IOException {
            return next().charAt(0);
        }
     
        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }
     
        public boolean ready() throws IOException {
            return br.ready();
        }
     
        public void waitForInput() throws InterruptedException {
            Thread.sleep(3000);
        }
        
    }
    static void shuffle(int[]in) {
        for(int i=0;i<in.length;i++) {
            int idx=(int)(Math.random()*in.length);
            int tmp=in[i];
            in[i]=in[idx];
            in[idx]=tmp;
        }
    }
    static void shuffle(long[]in) {
        for(int i=0;i<in.length;i++) {
            int idx=(int)(Math.random()*in.length);
            long tmp=in[i];
            in[i]=in[idx];
            in[idx]=tmp;
        }
    }
}