#include<bits/stdc++.h>
using namespace std;
using ll=long long;
static const ll mod=1000000007;
ll H,W;
char f[2005][2005];
ll modpow(ll x,ll y){
  if(y==0)
    return 1;
  else if(y%2==0){
  ll z=modpow(x,y/2);
    return (z*z)%mod;
  }else{
   ll z=modpow(x,y/2);
    return (x*((z*z)%mod))%mod;
  }
}
ll sum[2005][2005];
int main(){
cin>>H>>W;ll K=0;
  for(ll i=0;i<H;i++){
  string s;cin>>s;
    for(ll j=0;j<W;j++){
      f[i][j]=s[j];
    if(f[i][j]=='.')K++;
    }
  }
  for(ll i=0;i<H;i++){
  ll x=0;
    for(ll j=0;j<W;j++){
    if(f[i][j]=='#')
      x=0;
      else{
      x++;sum[i][j]+=x;
      }
     }
   } for(ll j=0;j<W;j++){
  ll x=0;
    for(ll i=H-1;0<=i;i--){
    if(f[i][j]=='#')
      x=0;
      else{
      x++;sum[i][j]+=x;
      }
     }
   } for(ll i=0;i<H;i++){
  ll x=0;
    for(ll j=W-1;0<=j;j--){
    if(f[i][j]=='#')
      x=0;
      else{
      x++;sum[i][j]+=x;
      }
     }
   } for(ll j=0;j<W;j++){
  ll x=0;
    for(ll i=0;i<H;i++){
    if(f[i][j]=='#')
      x=0;
      else{
      x++;sum[i][j]+=x;
      }
     }
   }ll ans=0;ll k=modpow(2,K);
  for(ll i=0;i<H;i++)
    for(ll j=0;j<W;j++)
      if(f[i][j]!='#'){
        ll y=sum[i][j]-3;
      ll x=(k-modpow(2,K-y)+mod)%mod;
      ans=(ans+x)%mod;
      }cout<<ans<<endl;
      return 0;
}
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

template<int M>
class ModInt {
   public:
    ll value;
    constexpr ModInt(ll v = 0) { value = v % M; if (value < 0) value += M; }
    constexpr ModInt pow(ll n) const { if (!n) return 1; ModInt a = pow(n >> 1); a *= a; if (n & 1) a *= *this; return a; }
    constexpr ModInt inv() const { return this->pow(M - 2); }
    constexpr ModInt operator + (const ModInt &rhs) const { return ModInt(*this) += rhs; };
    constexpr ModInt operator - (const ModInt &rhs) const { return ModInt(*this) -= rhs; };
    constexpr ModInt operator * (const ModInt &rhs) const { return ModInt(*this) *= rhs; };
    constexpr ModInt operator / (const ModInt &rhs) const { return ModInt(*this) /= rhs; };
    constexpr ModInt &operator += (const ModInt &rhs) { value += rhs.value; if (value >= M) value -= M; return *this; };
    constexpr ModInt &operator -= (const ModInt &rhs) { value -= rhs.value; if (value <  0) value += M; return *this; };
    constexpr ModInt &operator *= (const ModInt &rhs) { value = value * rhs.value % M; return *this; };
    constexpr ModInt &operator /= (const ModInt &rhs) { return (*this) *= rhs.inv(); };
    constexpr bool operator == (const ModInt &rhs) { return value == rhs.value; }
    constexpr bool operator != (const ModInt &rhs) { return value != rhs.value; }
    friend ostream &operator << (ostream &os, const ModInt &rhs) { os << rhs.value; return os; }
};

using mint = ModInt<MOD>;

int main() {
    int H, W; cin >> H >> W;
    vector<string> S(H);
    REP(i, 0, H) cin >> S[i];

    int tot = 0;
    vector<vector<int>> R(H, vector<int>(W, 0)), C(H, vector<int>(W, 0));
    REP(i, 0, H) REP(j, 0, W) {
        if (S[i][j] == '#') continue;
        R[i][j] = 1 + ((j > 0) ? R[i][j - 1] : 0);
        C[i][j] = 1 + ((i > 0) ? C[i - 1][j] : 0);
        tot++;
    }
    REP(i, 0, H) for (int j = W - 1; j > 0; j--) if (R[i][j] && R[i][j - 1]) R[i][j - 1] = R[i][j];
    REP(j, 0, W) for (int i = H - 1; i > 0; i--) if (C[i][j] && C[i - 1][j]) C[i - 1][j] = C[i][j];

    mint ans = 0;
    REP(i, 0, H) REP(j, 0, W) {
        if (S[i][j] == '#') continue;
        // cout << "#(" << i << "," << j << ") : " << R[i][j] << ", " << C[i][j] << endl; 
        int cnt = R[i][j] + C[i][j] - (R[i][j] && C[i][j]);
        ans += (mint(2).pow(cnt) - 1) * mint(2).pow(tot - cnt);
    }
    cout << ans << endl;

    return 0;
}