#include
using namespace std;
const int maxn = 89; const int mod = 1e9; const int movx[4] = {1, 0, -1, 0}; const int movy[4] = {0, 1, 0, -1};
int n, m, a[maxn][maxn], nid[11][11], t; char g[11][11];
#define _l (long long int)
#define mInc(a,b) {
a += b;
if (a >= mod)
a -= mod;
}
#define mDec(a,b) {
a -= b;
if (a < 0)
a += mod;
}
int matrixTree() { int sgn(1), s(1); for (int i = 1; i < t; ++ i) { if (!a[i][i]) return 0; for (int j = i + 1; j < t; ++ j) { while (1) { int rat(a[j][i] / a[i][i]); for (int k = i; k < t; ++ k) mDec(a[j][k], _l a[i][k] * rat % mod); if (a[j][i]) { sgn *= -1; for (int k = i; k < t; ++ k) swap(a[i][k], a[j][k]); } else break; } } } for (int i = 1; i < t; ++ i) s = _l s * a[i][i] % mod; s *= sgn; if (s < 0) s += mod; return s; }
int main() { #ifndef ONLINE_JUDGE freopen(".in", “r”, stdin); #endif
scanf("%d%d", &n, &m);
t = 0;
for (int i = 0; i < n; ++ i) {
scanf("%s", g[i]);
for (int j = 0; j < m; ++ j)
if (g[i][j] == '.')
nid[i][j] = t ++;
}
memset(a, 0, sizeof(a));
for (int i = 0; i < n; ++ i)
for (int j = 0; j < m; ++ j)
if (g[i][j] == '.')
for (int mi = 0; mi < 4; ++ mi) {
int x(i + movx[mi]), y(j + movy[mi]);
if (x < 0 || x >= n || y < 0 || y >= m || g[x][y] != '.')
continue;
mInc(a[nid[i][j]][nid[i][j]], 1);
mDec(a[nid[i][j]][nid[x][y]], 1);
}
printf("%d\n", matrixTree());
}