#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }     //最小公倍数
using Graph = vector<vector<int>>;
ll inf=300000000000000000;
const double PI = 3.14159265358979323846;
int main(){
  int h,w;
  cin >> h >> w;
  int k[h][w];
  ll p=1000000007;
  int u=0;
  rep(i,h){
    string s;
    cin >> s;
    rep(j,w){
      if(s[j]=='#'){
        k[i][j]=1;
      }
      else{
        k[i][j]=0;
        u++;
      }
    }
  }
  ll o[u+1];
  o[0]=1;
  rep(i,u)o[i+1]=o[i]*2%p;
  ll ans=0;
  int hh[h][w];
  int ww[h][w];
  rep(i,h){
    rep(j,w){
      //cout << ans << endl;
      if(k[i][j]==1)continue;
      else{
        int cnt=1;
        if(i>0){
          if(k[i-1][j]==0){
            cnt=cnt-1+hh[i-1][j];
            hh[i][j]=hh[i-1][j];
          }
        }
        if(cnt==1){
          int a=i+1;
          while(true){
            if(a<0||a>h-1)break;
            if(k[a][j]==1)break;
            cnt++;
            a++;
          }
          hh[i][j]=cnt;
          //if(i==0&&j==1)cout << cnt << endl;
        }
        if(j>0){
          if(k[i][j-1]==0){
            cnt=cnt-1+ww[i][j-1];
            ww[i][j]=ww[i][j-1];
          }
        }
        if(cnt==hh[i][j]){
          int a=j+1;
          while(true){
          if(a<0||a>w-1)break;
          if(k[i][a]==1)break;
          cnt++;
          a++;
          }
          ww[i][j]=a-j;
        }
        
        //cout << cnt <<" " <<  o[cnt] << " " << u-cnt << endl;
        ans=(ans+(o[cnt]-1)*o[u-cnt])%p;
      }
    }
  }
  //rep(i,3)cout << hh[0][i] << endl;
  cout << ans << endl;
} 

#include <bits/stdc++.h>

#ifndef M_PI
#define M_PI 3.14159265358979
#endif
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef pair<ll, ll> pll;
typedef pair<int, int> pi;
typedef long double ld;
typedef pair<long double, long double> pld;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

ll bpow(ll a, ll b) {
    ll res = 1;
    while(b) {
        if(b & 1)
            res = 1LL * res * a % MOD;
        a = 1LL * a * a % MOD;
        b >>= 1;
    }
    return res;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll i, j, k;

    ll H, W;
    cin >> H >> W;
    vector<string> S(H);
    for(auto &e : S)
        cin >> e;
    vector<vll> cv;
    vector<vll> ch;
    for(i = 0; i < H; i++) {
        vll h(W);
        ll p = 0;
        for(j = 0; j < W; j++) {
            if(S[i][j] == '.') {
                p++;
            } else {
                p = 0;
            }
            h[j] = p;
        }
        for(j = W - 2; j >= 0; j--) {
            if(h[j] > 0 && h[j + 1] > 0) {
                h[j] = h[j + 1];
            }
        }
        ch.push_back(h);
    }
    for(j = 0; j < W; j++) {
        vll v(H);
        ll p = 0;
        for(i = 0; i < H; i++) {
            if(S[i][j] == '.') {
                p++;
            } else {
                p = 0;
            }
            v[i] = p;
        }
        for(i = H - 2; i >= 0; i--) {
            if(v[i] > 0 && v[i + 1] > 0) {
                v[i] = v[i + 1];
            }
        }
        cv.push_back(v);
    }
    for(i = 0; i < H; i++) {
        for(j = 0; j < W; j++) {
            ch[i][j] += cv[j][i] - 1;
        }
    }

    ll n_e = 0;
    for(i = 0; i < H; i++) {
        for(j = 0; j < W; j++) {
            if(S[i][j] == '.')
                n_e++;
        }
    }
    ll n_b = bpow(2, n_e);

    ll ans = 0;
    for(i = 0; i < H; i++) {
        for(j = 0; j < W; j++) {
            if(S[i][j] == '#')
                continue;
            ll sub = n_b;
            ll msub = bpow(2, n_e - ch[i][j]);
            sub = (sub + MOD - msub) % MOD;
            ans = (ans + sub) % MOD;
        }
    }
    cout << ans << endl;

    return 0;
}
