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:
/* cerberus97 - Hanit Banga */

#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)

typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 10, S = (1 << N) + 10, mod = 998244353;

inline void add(int& a, int b) {
	a += b;
	if (a >= mod) a -= mod;
}

inline int mul(ll a, int b) {
	return (a * b) % mod;
}

string a[N];
int h, w, cnt[S], p2[N];
int dp[S][S][2][2];
bool seen[S][S][2][2], dp2[S][S], seen2[S][S];

int main() {
	fast_cin();
	cin >> h >> w;
	for (int i = 0; i < h; ++i) {
		cin >> a[i];
		for (auto& c : a[i]) {
			c = (1 << (c == '#'));
		}
	}
	for (int i = 0; i <= max(h, w); ++i) {
		p2[i] = (1 << i);
	}
	int mrows = (1 << h), mcols = (1 << w);
	for (int mask = 0; mask < max(mrows, mcols); ++mask) {
		cnt[mask] = __builtin_popcount(mask);
	}
	for (int rows = 0; rows < mrows; ++rows) {
		for (int cols = 0; cols < mcols; ++cols) {
			bool& ans = dp2[rows][cols];
			vector<int> cr(h, 0), cc(w, 0);
			for (int i = 0; i < h; ++i) {
				if (!((rows >> i) & 1)) {
					continue;
				}
				for (int j = 0; j < w; ++j) {
					if (!((cols >> j) & 1)) {
						continue;
					}
					cr[i] |= a[i][j];
					cc[j] |= a[i][j];
				}
			}
			ans = true;
			for (int i = 0; i < h; ++i) {
				ans &= !((rows >> i) & 1) or (cr[i] == 3);
			}
			for (int j = 0; j < w; ++j) {
				ans &= !((cols >> j) & 1) or (cc[j] == 3);
			}
		}
	}
	for (int rows = 0; rows < mrows; ++rows) {
		for (int cols = 0; cols < mcols; ++cols) {
			for (int turn = 0; turn < 2; ++turn) {
				for (int must = 0; must < 2; ++must) {
					int& ans = dp[rows][cols][turn][must];
					if (!rows or !cols) {
						ans = (must == 0);
					} else {
						add(ans, dp2[rows][cols]);
						int submask = (turn ? cols : rows);
						while (submask) {
							int nrows = rows - (turn ? 0 : submask);
							int ncols = cols - (turn ? submask : 0);
							add(ans, dp[nrows][ncols][turn ^ 1][1]);
							if (must == 0) {
								add(ans, dp[nrows][ncols][turn ^ 1][1]);
								if (cnt[submask] > 1) {
									add(ans, mul(p2[cnt[submask]] - 2, dp[nrows][ncols][turn ^ 1][0]));
								}
							}
							submask = (submask - 1) & (turn ? cols : rows);
						}
					}
				}
			}
		}
	}
	int ans = 0;
	for (int mask = 0; mask < (1 << w); ++mask) {
		// add(ans, mul(p2[cnt[mask]], solve((1 << h) - 1, (1 << w) - 1 - mask, 0, 0)));
		add(ans, mul(p2[cnt[mask]], dp[(1 << h) - 1][(1 << w) - 1 - mask][0][0]));
	}
	cout << ans << endl;
}