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>
using namespace std;
typedef long long ll;
const int N=22,mod=998244353;
ll fc[N],ifc[N],p[N],col[N][N][3],row[N][N][3];
ll inv(ll x){return x<=1?x:(mod-mod/x)*inv(mod%x)%mod;}
ll C(int n,int m)
{
    return fc[n]*ifc[n-m]%mod*ifc[m]%mod;
}
ll iC(int n,int m)
{
    return inv(C(n,m));
}
int n,m,r[N],c[N];
char s[N][N];
void init()
{
    fc[0]=fc[1]=ifc[0]=ifc[1]=p[0]=1;
    for(int i=2;i<N;i++) fc[i]=fc[i-1]*i%mod,ifc[i]=(mod-mod/i)*ifc[mod%i]%mod;
    for(int i=2;i<N;i++) ifc[i]=ifc[i]*ifc[i-1]%mod;
    for(int i=1;i<N;i++) p[i]=p[i-1]*2%mod;
}
void Dp()
{
    for(int j=1;j<=m;j++)
        col[n][j][2]=C(m,j)*p[m-j]%mod;
    ll ans=p[m];
    for(int i=n;i>=1;i--)
        for(int j=m;j>=1;j--)
    {
        col[i][j][0]=(col[i][j][1]+col[i][j][2])%mod;
        for(int k=1;k<i;k++)
        {
            int d=i-k;
            (row[k][j][1]+=C(i,d)*(col[i][j][2]*2+col[i][j][1])%mod)%=mod;
            (row[k][j][2]+=C(i,d)*(p[d]-2)%mod*col[i][j][2]%mod)%=mod;
        }
        ans=(ans+col[i][j][2]*(p[i]-2))%mod;
        row[i][j][0]=(row[i][j][1]+row[i][j][2])%mod;
        for(int k=1;k<j;k++)
        {
            int d=j-k;
            (col[i][k][1]+=C(j,d)*(row[i][j][2]*2+row[i][j][1])%mod)%=mod;
            (col[i][k][2]+=C(j,d)*(p[d]-2)%mod*row[i][j][2]%mod)%=mod;
        }
        ans=(ans+row[i][j][2]*(p[j]-2))%mod;
    }
    int upn=1<<n,upm=1<<m;
    for(int i=1;i<upn;i++)
        for(int j=1;j<upm;j++)
    {
        bool flag=true;
        for(int k=0;k<n;k++)
            if(i>>k&1)
        {
            int w=r[k+1]&j;
            if(w==j||w==0) flag=false;
        }
        for(int k=0;k<m;k++)
            if(j>>k&1)
        {
            int w=c[k+1]&i;
            if(w==i||w==0) flag=false;
        }
        if(!flag) continue;
        int x=__builtin_popcount(i),y=__builtin_popcount(j);
        ans=(ans+(row[x][y][0]+col[x][y][0])*iC(n,x)%mod*iC(m,y))%mod;
    }
    printf("%lld\n",ans);
}
int main()
{
    init();
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++) scanf("%s",s[i]+1);
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
        if(s[i][j]=='.') r[i]|=1<<j>>1,c[j]|=1<<i>>1;
    Dp();
}