#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

#include <bits/stdc++.h>
// #include <atcoder/all>
// #include "icld.cpp"
using namespace std;
using ll = long long int;
using vi = vector<int>;
using si = set<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using ss = string;
using db = double;
template<typename T> using minpq = priority_queue <T,vector<T>,greater<T>>;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
#define V vector
#define P pair<int,int>
#define rep(i,s,n) for(int i=(s);i<(int)(n);i++)
#define rev(i,s,n) for(int i=(s);i>=(int)(n);i--)
#define reciv(v,n) vi (v)((n)); rep(i,0,(n))cin>>v[i]
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define ci(x) cin >> x
#define cii(x) ll x;cin >> x
#define cci(x,y) ll x,y;cin >> x >> y
#define co(x) cout << x << endl
#define pb push_back
#define eb emplace_back
#define rz resize
#define sz(x) int(x.size())
#define yn cout<<"Yes"<<endl;else cout<<"No"<<endl
#define YN cout<<"YES"<<endl;else cout<<"NO"<<endl
template<class T>void chmax(T &x,T y){x=max(x,y);}
template<class T>void chmin(T &x,T y){x=min(x,y);}

ll p=1e9+7;

ll f(ll n){
  if(n==0)return 1;
  if(n==1)return 2;
  if(n%2)return 2*f(n-1)%p;
  ll res=f(n/2);
  return res*res%p;
}
int main(){
  cci(h,w);
  
  int k=0;
  vvi v(h+2,vi(w+2,-1));
  rep(i,0,h){
    rep(j,0,w){
      char c;ci(c);
      if(c=='.')v[i+1][j+1]=0,k++;
    }
  }

  vvi tt=v,yk=v;
  rep(i,1,h+1){
    int now=0;

    rep(j,1,w+1){
      if(v[i][j]==0)yk[i][j]=++now;
      else now=0;
    }
    rev(j,w,1){
      if(yk[i][j]==-1)continue;
      chmax(yk[i][j],yk[i][j+1]);
    }
  }

  rep(i,1,w+1){
    int now=0;

    rep(j,1,h+1){
      if(v[j][i]==0)tt[j][i]=++now;
      else now=0;
    }
    rev(j,h,1){
      if(tt[j][i]==-1)continue;
      chmax(tt[j][i],tt[j+1][i]);
    }
  }

  ll ans=0;
  ll k2=f(k);
  map<int,int>mp;

  rep(i,1,h+1){
    rep(j,1,w+1){
      ll now=max(-1,yk[i][j]+tt[i][j]-1);
// cout<<now<<" ";
      mp[now]++;
    }
// co("");
  }

  for(auto x:mp){
    if(x.first==-1)continue;
    ll now=k2-f(k-x.first);
    ans+=now*x.second%p;
    ans%=p;
  }

  ans=(ans+p)%p;
  co(ans);  
}