#include <bits/stdc++.h>

#pragma GCC optimize("Ofast")
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
constexpr ll mod = 1e9 + 7;

ll modpow(ll a, ll b) {
  ll r = 1;
  while (b) {
    if (b & 1) r = r * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return r;
}

int main() {
  // ios::sync_with_stdio(false);
  // cin.tie(nullptr);
  ll n, w, h, ans = 0, cnt = 0;
  cin >> h >> w;
  string s[h];
  ll tate[h][w] = {}, yoko[h][w] = {};
  rep(i, h) cin >> s[i];
  rep(i, h) rep(j, w) if (s[i][j] == '.') cnt++;


  if (cnt == h * w) {
    ll t = h + w - 1;
    ans = (modpow(2, t) - 1) * modpow(2, h * w - t);
    ans %= mod;
    ans *= h * w;
    ans %= mod;
    cout << ans << endl;
    return 0;
  }
  ans = 0;

  rep(i, h) rep(j, w) {
    if (s[i][j] == '#') continue;
    ll now = 1;
    for (int k = i - 1; k >= 0; --k)
      if (s[k][j] == '.')
        now++;
      else
        break;

    for (int k = i + 1; k < h; ++k)
      if (s[k][j] == '.')
        now++;
      else
        break;

    for (int k = j - 1; k >= 0; --k)
      if (s[i][k] == '.')
        now++;
      else
        break;

    for (int k = j + 1; k < w; ++k)
      if (s[i][k] == '.')
        now++;
      else
        break;

    ll add = (modpow(2, now) - 1) * modpow(2, cnt - now) % mod;
    (ans += add) %= mod;
  }

  cout << ans << endl;
  return 0;
}

#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#pragma GCC optimize(2)
#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<string>
#include<vector>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int N=2010;
const ll mod=1e9+7;
char g[N][N];
int n,m;
ll base[N*N];
int w[N][N];
int main()
{
    IO;
    int T=1;
    //cin>>T;
    while(T--)
    {
        cin>>n>>m;
        for(int i=1;i<=n;i++) cin>>g[i]+1;
        
        int cnt=0;
        for(int i=1;i<=n;i++)
            for(int j=1;j<=m;j++) cnt+=(int)g[i][j]=='.';
            
        base[0]=1;
        for(int i=1;i<=cnt;i++) base[i]=base[i-1]*2%mod;
        ll res=0;
        for(int i=1;i<=n;i++)
        {
            int j=1;
            while(j<=m)
            {
                while(g[i][j]=='#') j++;
                
                int now=1,k=1;
                while(j+k<=m&&g[i][j+k]=='.') now++,k++;
                for(int p=j;p<j+k;p++) w[i][p]+=now;
                j=j+k;
            }
        }
        for(int i=1;i<=m;i++)
        {
            int j=1;
            while(j<=n)
            {
                while(g[j][i]=='#') j++;
                int now=1,k=1;
                while(j+k<=n&&g[j+k][i]=='.') now++,k++;
                for(int p=j;p<j+k;p++) w[p][i]+=now;
                j=j+k;
            }
        }
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)
            {
                if(g[i][j]=='#') continue;
                int now=w[i][j]-1;
                res=(res+(base[now]-1)*base[cnt-now]%mod)%mod;
                
            }
        }
        
        cout<<(ll)(res+mod)%mod<<'\n';
        
    }
    return 0;
}