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

#define LL long long
const int N = 2005, mod = 1e9 + 7;
char c[N][N];
int h, w, s, p[N*N], d[N][N], r[N][N], l[N][N], u[N][N], ans;

int main() {
    ios::sync_with_stdio(0), cin.tie(0);
    
    p[0] = 1;
    for(int i = 1; i < N*N; i++) p[i] = p[i-1] * 2 % mod;

    cin >> h >> w;
    for(int i = 1; i <= h; i++) {
        for(int j = 1; j <= w; j++) {
            cin >> c[i][j];
            if(c[i][j] == '#') continue;
            u[i][j] = u[i-1][j] + 1, l[i][j] = l[i][j-1] + 1;
            s++;
        }
    }    

    for(int i = h; i > 0; i--) {
        for(int j = w; j > 0; j--) {
            if(c[i][j] == '#') continue;
            d[i][j] = d[i+1][j] + 1, r[i][j] = r[i][j+1] + 1;
            int x = u[i][j] + r[i][j] + l[i][j] + d[i][j] - 3;
            ans += (1LL * p[s-x] * ((p[x] - 1 + mod) % mod)) % mod;
            ans %= mod;
        }
    }

    cout << ans;
}
#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;
    mint ans = (mint)tot * mint(2).pow(tot);
    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(tot - cnt);
        // ans += (mint(2).pow(cnt) - 1) * mint(2).pow(tot - cnt);
    }
    cout << ans << endl;

    return 0;
}