Problem: We have an H \times W grid, where each square is painted white or black in the initial state. Given are strings A_1, A_2, ..., A_H representing the colors of the squares in the initial state. For each pair (i, j) (1 \leq i \leq H, 1 \leq j \leq W), if the j-th character of A_i is `.`, the square at the i-th row and j-th column is painted white; if that character is `#`, that square is painted black.

Among the 2^{HW} ways for each square in the grid to be painted white or black, how many can be obtained from the initial state by performing the operations below any number of times (possibly zero) in any order? Find this count modulo 998,244,353.

* Choose one row, then paint all the squares in that row white.
* Choose one row, then paint all the squares in that row black.
* Choose one column, then paint all the squares in that column white.
* Choose one column, then paint all the squares in that column black.

Constraints

* 1 \leq H, W \leq 10
* |A_i| = W (1 \leq i \leq H)
* All strings A_i consist of `.` and `#`.
* H and W are integers.

Input

Input is given from Standard Input in the following format:


H W
A_1
A_2
\vdots
A_H


Output

Print the answer.

Examples

Input

2 2
#.
.#


Output

15


Input

2 2
.
.#


Output

15


Input

3 3
...
...
...


Output

230


Input

2 4
...
...#


Output

150


Input

6 7
.......
.......
.#.....
..#....
.#.#...
.......


Output

203949910

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) (((x) < 0)?-(x):(x))
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge

using cat = long long;

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

cat mod = 998244353;
cat C[11][11];

void count(int h, int w, char f_e, char f_h, char f_w, int & out, cat cur = 1) {
	if(h+w == 0) {
		out += cur;
		if(out >= mod) out -= mod;
		return;
	}
	if(!(f_e&1) && h*w == 0) return;
	for(int c = 0; c < 2; c++) for(int i = 0; i <= h; i++) for(int j = 0; j <= w; j++) if(i+j) {
		if((f_h>>c)&1 && i) continue;
		if((f_w>>c)&1 && j) continue;
		if(j && f_e&2 && c) continue;
		if(i && f_e&4 && c) continue;
		cat x = C[h][i] * C[w][j] % mod;
		int n_h = f_h, n_w = f_w;
		if(i) n_w ^= n_w&(1<<(1-c));
		if(j) n_h ^= n_h&(1<<(1-c));
		n_h |= 1<<c;
		n_w |= 1<<c;
		int n_e = f_e&1;
		if(!i) n_e |= 2;
		if(!j) n_e |= 4;
		count(h-i, w-j, n_e, n_h, n_w, out, cur*x%mod);
	}
}

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	int H, W;
	cin >> H >> W;
	vector<int> V(H, 0);
	for(int i = 0; i < H; i++) {
		string s;
		cin >> s;
		for(int j = 0; j < W; j++)
			if(s[j] == '#') V[i] |= 1<<j;
	}
	memset(C, 0, sizeof(C));
	for(int i = 0; i <= 10; i++) {
		C[i][0] = 1;
		for(int j = 1; j <= i; j++)
			C[i][j] = (C[i-1][j]+C[i-1][j-1])%mod;
	}
	int cnt[11][11];
	memset(cnt, 0, sizeof(cnt));
	for(int i = 0; i <= H; i++) for(int j = 0; j <= W; j++)
		count(i, j, (H-i) || (W-j), 0, 0, cnt[i][j]);
	cat ans = cnt[H][W];
	for(int i = 0; i < (1<<H)-1; i++) {
		vector<int> Vr, Vc(W, 0);
		for(int j = 0; j < H; j++)
			if(!((i>>j)&1)) Vr.push_back(V[j]);
		for(int j = 0; j < W; j++) {
			for(int k = 0; k < H; k++)
				if(!((i>>k)&1)) Vc[j] += ((V[k]>>j)&1)<<k;
			Vc[j] = (!Vc[j]) || (Vc[j] == (1<<H)-1-i);
		}
		int n = H-Vr.size();
		for(int j = 0; j < (1<<W)-1; j++) {
			int m = (1<<W)-1-j;
			bool ok = true;
			for(int k = 0; k < H-n; k++) if(!(Vr[k]&m) || (Vr[k]&m) == m) {
				ok = false;
				break;
			}
			if(!ok) continue;
			for(int k = 0; k < W; k++) if(!((j>>k)&1) && Vc[k]) {
				ok = false;
				break;
			}
			if(!ok) continue;
			ans += cnt[n][__builtin_popcount(j)];
			if(ans >= mod) ans -= mod;
		}
	}
	cout << ans << "\n";
	return 0;
}

// look at my code
// my code is amazing