//#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>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
constexpr int mod = 1e9+7;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};

int main(){
  int h, w;
  cin >> h >> w;
  vector<string> s(h);
  rep(i,h) cin >> s[i];

  vector<vector<mint>> dp(h, vector<mint>(w, 0));
  vector<vector<mint>> a(h + 1, vector<mint>(w + 1, 0)), b(h + 1, vector<mint>(w + 1, 0)), c(h + 1, vector<mint>(w + 1, 0));
  dp[0][0] = 1;
  
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (j - 1 >= 0 && s[i][j - 1] == '.') a[i][j] += dp[i][j - 1] + a[i][j - 1];
      if (i - 1 >= 0 && s[i - 1][j] == '.') b[i][j] += dp[i - 1][j] + b[i - 1][j];
      if (i - 1 >= 0 && j - 1 >= 0 && s[i - 1][j - 1] == '.') c[i][j] += dp[i - 1][j - 1] + c[i - 1][j - 1];
      dp[i][j] += a[i][j] + b[i][j] + c[i][j];
    }
  }
  cout << dp[h - 1][w - 1].x << endl;
  return 0;
}