#include <iostream>
using namespace std;
using ll = long long;

int mod = 1e9 + 7;
char s[2008][2008];
ll ans[4][2008][2008];
ll dp[2008][2008];
int main()
{
    int n, m;
    cin >> n >> m;
    dp[1][1] = 1;
    for (int i = 1; i <= n; i++) cin >> s[i] + 1;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            if (s[i][j] == '#') {
                ans[1][i][j] = 0;
                ans[2][i][j] = 0;
                ans[3][i][j] = 0;
                continue;
            }
            dp[i][j] += ans[1][i - 1][j];
            dp[i][j] %= mod;
            dp[i][j] += ans[2][i][j - 1];
            dp[i][j] %= mod;
            dp[i][j] += ans[3][i - 1][j - 1];
            dp[i][j] %= mod;
            ans[1][i][j] = (ans[1][i - 1][j] + dp[i][j]) % mod;
            ans[2][i][j] = (ans[2][i][j - 1] + dp[i][j]) % mod;
            ans[3][i][j] = (ans[3][i - 1][j - 1] + dp[i][j]) % mod;
        }
    }
    cout << dp[n][m] << endl;
    return 0;
}

//#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 & 3)) {
			rep1(j, W - 1) {
				if (getchar_unlocked() == '.') {
					tmp = (w + dph[j] + naname[j - i]) % mod;
					w = (w + tmp) % mod;
					dph[j] = (tmp + dph[j]) % mod;
					naname[j - i] = (tmp + naname[j - i]) % mod;
				}
				else {
					w = 0;
					dph[j] = 0;
					naname[j - i] = 0;
				}
			}
		}
		else {
			rep1(j, W - 1) {
				if (!(j & 3)) {
					if (getchar_unlocked() == '.') {
						tmp = (w + dph[j] + naname[j - i]) % mod;
						w = (w + tmp) % mod;
						dph[j] = (tmp + dph[j]) % mod;
						naname[j - i] = (tmp + naname[j - i]) % 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;
}