//#pragma GCC optimize ("O2")
//#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
//#include<atcoder/all>
//using namespace atcoder;

#include<cstdio>

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

ll dph[2000], dphw[4000], *naname = dphw + 2000;
const int mod = 1e9 + 7;

int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);


	int H = 0, W = 0;
	char c;
	while ((c = getchar_unlocked()) >= '0') H = H * 10 + c - '0';
	while ((c = getchar_unlocked()) >= '0') W = W * 10 + c - '0';


	getchar_unlocked();
	dph[0] = 1;
	naname[0] = 1;
	ll w = 1;
	ll tmp = 1;
	rep1(i, W - 1) {
		tmp = w;
		if (getchar_unlocked() == '.') {
			dph[i] = w;
			naname[i] = w;
			w = w * 2 % mod;
		}
		else {
			dph[i] = 0;
			naname[i] = 0;
			w = 0;
		}
	}
	getchar_unlocked();

	rep1(i, H - 1) {
		if (getchar_unlocked() == '.') {
			tmp = dph[0];
			w = tmp;
			dph[0] = (tmp + dph[0]) % mod;
			naname[-i] = (tmp + naname[-i]) % mod;
		}
		else {
			w = 0;
			dph[0] = 0;
			naname[-i] = 0;
		}
		if (!(i & 7)) {
			rep1(j, W - 1) {
				if (getchar_unlocked() == '.') {
					tmp = w + dph[j] + naname[j - i];
					w += tmp - ll(double(w + tmp) / mod) * mod;
					dph[j] += tmp - ll(double(dph[j] + tmp) / mod) * mod;
					naname[j - i] += tmp - ll(double(tmp + naname[j - i]) / mod) * mod;
				}
				else {
					w = 0;
					dph[j] = 0;
					naname[j - i] = 0;
				}
			}
		}
		else {
			rep1(j, W - 1) {
				if (!(j & 7)) {
					if (getchar_unlocked() == '.') {
						tmp = w + dph[j] + naname[j - i];
						w += tmp - ll(double(w + tmp) / mod) * mod;
						dph[j] += tmp - ll(double(dph[j] + tmp) / mod) * mod;
						naname[j - i] += tmp - ll(double(tmp + naname[j - i]) / mod) * mod;
					}
					else {
						w = 0;
						dph[j] = 0;
						naname[j - i] = 0;
					}
				}
				else {
					if (getchar_unlocked() == '.') {
						tmp = w + dph[j] + naname[j - i];
						w = w + tmp;
						dph[j] = tmp + dph[j];
						naname[j - i] = tmp + naname[j - i];
					}
					else {
						w = 0;
						dph[j] = 0;
						naname[j - i] = 0;
					}
				}
			}
		}
		getchar_unlocked();
	}


	printf("%lld\n", tmp % mod);

	Would you please return 0;
}
#include<bits/stdc++.h>
#include<iostream>
#include<map>
#include<math.h>
#include<string>
#include<string.h>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
#define _GLIBCXX_DEBUG
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
using namespace std;
using ll=long long;
const ll INF=5000000000000;
const ll dx[8]={1,0,-1,0,1,1,-1,-1};
const ll dy[8]={0,1,0,-1,1,-1,1,-1};
ll mod(ll x,ll m){return x & m;}
ll modinv(ll a,ll m){ll b=m,u=1,v=0;while(b){ll t=a/b;a-=t*b;swap(a,b);u-=t*v;swap(u,v);}u%=m;if(u<0){u+=m;}return u;}
ll modpow(ll a,ll n,ll m){ll res=1;while(n>0){if(n&1){res=res*a%m;}a=a*a%m;n>>=1;}return res;}
ll npow(ll a,ll n){ll res=1;while(n>0){if(n&1){res=res*a;}a=a*a;n>>=1;}return res;}
ll yaku(ll x){ll cnt=0;for(int i=1;i*i<=x;i++){if(x%i==0){if(i==x/i){cnt++;}else{cnt+=2;}}}return cnt;}
ll modwaru(ll a, ll b, ll m){a%=m;return a*modinv(b,m)%m;}
ll gcd(ll x, ll y){if(x%y==0){return y;}else{return gcd(y, x % y);}}
ll lcm(ll a, ll b){return a/gcd(a, b)*b;}
struct UnionFind{vector<ll>par;UnionFind(ll N):par(N){for(ll i=0;i<N;i++)par[i]=i;}ll root(ll x){if(par[x]==x){return x;}return par[x]=root(par[x]);}void unite(ll x,ll y){ ll rx=root(x);ll ry=root(y);if(rx==ry){return;}par[rx]=ry;}bool same(ll x,ll y){ll rx=root(x);ll ry=root(y);return rx==ry;}};

int main(){
    ll H, W, M = 1000000007;
    cin >> H >> W;
    vector<vector<char>> S(H, vector<char>(W));
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++) cin >> S[i][j];
    }
    vector<vector<ll>> dp(H + 1, vector<ll>(W + 1, 0)), tate(H + 1, vector<ll>(W + 1, 0)), yoko(H + 1, vector<ll>(W + 1, 0)), naname(H + 1, vector<ll>(W + 1, 0));
    dp[1][1] = 1;
    for(int i = 1; i <= H; i++){
        for(int j = 1; j <= W; j++){
            if(S[i - 1][j - 1] == '#') continue;
            tate[i][j] += tate[i - 1][j] + dp[i - 1][j];
            yoko[i][j] += yoko[i][j - 1] + dp[i][j - 1];
            naname[i][j] += naname[i - 1][j - 1] + dp[i - 1][j - 1];
            dp[i][j] += tate[i][j] + yoko[i][j] + naname[i][j];
            tate[i][j] %= M;
            yoko[i][j] %= M;
            naname[i][j] %= M;
            dp[i][j] %= M;
        }
    }
    cout << dp[H][W] << endl;
}