#include <bits/stdc++.h>
using namespace std;

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

const ll MOD = 1e9+7;

ll pow_mod(ll a, ll n, ll p)
{
    ll res = 1;
    while(n > 0){
        if(n & 1) res = res*a%p;
        a = a*a%p;
        n >>= 1;
    }
    return res;
}

int main()
{
    ll i,j;
    ll h,w;
    cin >> h >> w;
    vector<string> s(h);
    rep(i,h) cin >> s[i];
    vector<vector<int>> yoko(h);
    vector<vector<int>> tate(w);
    int k = 0;
    rep(i,h) rep(j,w) if(s.at(i).at(j) == '.') ++k;
    rep(i,h){
        yoko.at(i).push_back(-1);
        rep(j,w){
            if(s.at(i).at(j) == '#') yoko.at(i).push_back(j);
        }
        yoko.at(i).push_back(w);
    }
    rep(i,w){
        tate.at(i).push_back(-1);
        rep(j,h){
            if(s.at(j).at(i) == '#') tate.at(i).push_back(j);
        }
        tate.at(i).push_back(h);
    }
    ll ans = 0;
    rep(i,h){
        rep(j,w){
            if(s.at(i).at(j) == '#') continue;
            ll tmp = 0;
            ll ind1 = lower_bound(all(yoko.at(i)), j) - yoko.at(i).begin();
            tmp += yoko.at(i).at(ind1) - yoko.at(i).at(ind1 - 1) - 1;
            ll ind2 = lower_bound(all(tate.at(j)), i) - tate.at(j).begin();
            tmp += tate.at(j).at(ind2) - tate.at(j).at(ind2 - 1) - 1;
            --tmp;
            ans += (pow_mod(2, tmp, MOD) + MOD - 1)%MOD*(pow_mod(2, k - tmp, MOD))%MOD;
            ans %= MOD;
        }
    }
    cout << ans << endl;

    return 0;
}
#include <bits/stdc++.h>
using namespace std;
#define SZ(a) ((int)(a).size())
typedef long long int64;
int main() {
#ifdef LOCAL
  freopen(".a.in", "r", stdin);
#endif
  ios_base::sync_with_stdio(false);
  cout.tie(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<string> S(n);
  vector<vector<int>> A(n, vector<int>(m)), B(n, vector<int>(m)), C(n, vector<int>(m)), D(n, vector<int>(m));
  int K = 0;
  for (int i = 0; i < n; ++i) cin >> S[i], K += count(S[i].begin(), S[i].end(), '.');
  int64 md = 1e9 + 7;
  vector<int64> two(max(100, K + 2));
  two[0] = 1;
  for (int i = 1; i < SZ(two); ++i) two[i] = two[i - 1] * 2 % md;
  int64 res = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      if (S[i][j] == '.') {
        A[i][j] = 1;
        if (i - 1 >= 0) A[i][j] += A[i - 1][j];
        B[i][j] = 1;
        if (j - 1 >= 0) B[i][j] += B[i][j - 1];
      }
    }
  }
  for (int i = n - 1; i >= 0; --i) {
    for (int j = m - 1; j >= 0; --j) {
      if (S[i][j] == '.') {
        C[i][j] = D[i][j] = 1;
        if (i + 1 <= n - 1) C[i][j] += C[i + 1][j];
        if (j + 1 <= m - 1) D[i][j] += D[i][j + 1];
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j)
      if (S[i][j] == '.') {
        int tot = A[i][j] + B[i][j] + C[i][j] + D[i][j] - 3;
        (res += (two[tot] + md - 1) * two[K - tot] % md) %= md;
      }
  }
  cout << res;
  return 0;
}
//14.10.2020 04:31:12 CST
