#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=4e3+9;
const int MAX=1e2+9;
const double ep=1e-10;
const int mod=1e9+7;
const int INF=0x3f3f3f3f;
const double inf=1e20;
const double pi=acos(-1);
#define debug1 puts("?");
#define debug(x) cout<<"##"<<(x)<<endl;
#define mk make_pair
#define PII pair<int,int>
#define PDI pair<double,int>
#define PIII pair<int,PII >
#define PIII1 pair<PII,int>
#define PIIII pair<PII,PII >
#define PIL pair<int,ll>
#define PLI pair<ll,int>
#define PLIII pair<PLI,PII >
#define PLL pair<ll,ll>
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define dep(i,a,b) for(int i=(a);i>=(b);--i)
#define sd(x) scanf("%d",&(x))
#define slld(x) scanf("%lld",&(x))
#define sdd(x,y) scanf("%d%d",&(x),&(y))
#define sc(s) scanf("%s",(s))
#define pd(x) printf("%d\n",(x))
#define plld(x) printf("%lld\n",(x))
#define pdk(x) printf("%d ",(x))
#define plldk(x) printf("%lld ",(x))
#define pdd(x,y) printf("%d %d\n",(x),(y))
#define PR(x) printf("Case %d: ",(x))

/*

*/ 
ll dp[maxn][maxn],u[maxn],l[maxn],d[maxn];
int n,m;
char s[maxn][maxn];
void solve()
{
	sdd(n,m);
	rep(i,1,n)sc(s[i]+1);
	u[1]=l[1]=d[1]=dp[1][1]=1;
	rep(i,1,n)
	{
		rep(j,1,m)
		{
			if(i==1&&j==1)continue;
			int dd;
			if(j>=i)dd=j-i+1;
			else dd=i-j+1+m;
			if(s[i][j]=='#')
			{
				u[j]=l[i]=d[dd]=0;
				continue;
			}
			dp[i][j]=(l[i]+u[j]+d[dd])%mod;
			l[i]=(l[i]+dp[i][j])%mod;
			u[j]=(u[j]+dp[i][j])%mod;
			d[dd]=(d[dd]+dp[i][j])%mod;
//			cout<<i<<' '<<j<<' '<<l[i]<<' '<<u[j]<<' '<<d[dd]<<dp[i][j]<<endl;
		}
	}
	plld(dp[n][m]);
}
int main()
{
//    ios::sync_with_stdio(false);
//    cin.tie(0);
    int T=1;
//    sd(T);
    while(T--)solve(); 
}
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Pine1999
 */

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

template<int mod>
class Modular {
public:
    int x;
    Modular() : x(0) {}
    Modular(long long y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
    Modular &operator+=(const Modular& p) { if ((x += p.x) >= mod) x -= mod; return *this; }
    Modular &operator-=(const Modular& p) { if ((x -= p.x) < 0) x += mod; return *this; }
    Modular &operator*=(const Modular& p) { x = (int) (1LL * x * p.x % mod); return *this; }
    Modular &operator/=(const Modular& p) { *this *= p.Inverse(); return *this; }
    Modular operator-() const { return Modular(-x); }
    Modular operator+(const Modular& p) { return Modular(*this) += p; }
    Modular operator-(const Modular& p) { return Modular(*this) -= p; }
    Modular operator*(const Modular& p) { return Modular(*this) *= p; }
    Modular operator/(const Modular& p) { return Modular(*this) /= p; }
    bool operator==(const Modular& p) { return x == p.x; }
    bool operator!=(const Modular& p) { return x != p.x; }
    friend std::ostream& operator<<(std::ostream& out, const Modular& p) { return out << p.x; }
    friend std::istream& operator>>(std::istream& in, Modular& a) {
        long long t;
        in >> t;
        a = Modular<mod>(t);
        return in;
    }
    Modular Inverse() const {
        int a = x, m = mod, u = 1, v = 0, t;
        while (m > 0) {
            t = a / m;
            std::swap(a -= t * m, m);
            std::swap(u -= t * v, v);
        }
        return Modular(u);
    }
    Modular Pow(long long a, long long b) {
        assert(b >= 0);
        Modular r(1), mul(a);
        while (b > 0) {
            if (b & 1) r *= mul;
            mul *= mul;
            b >>= 1;
        }
        return r;
    }
};
// 入力時に mod を受け取る場合は, template<int& mod> にして,
// static int mod; cin >> mod; using mint = Modular<mod>; で良い.

const int mod = (int) 1e9 + 7;
using mint = Modular<mod>;

void solve(std::istream& in, std::ostream& out) {
    int h, w;
    in >> h >> w;
    vector<string> s(h);
    for (int i = 0; i < h; ++i) in >> s[i];
    vector<vector<mint>> sum1(h, vector<mint> (w)), sum2(h, vector<mint> (w)), sum3(h, vector<mint> (w));
    vector<vector<mint>> dp(h, vector<mint> (w));
    sum1[0][0] = 1;
    sum2[0][0] = 1;
    sum3[0][0] = 1;
    dp[0][0] = 1;
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            if (s[i][j] == '#') {
                sum1[i][j] = 0;
                sum2[i][j] = 0;
                sum3[i][j] = 0;
                dp[i][j] = 0;
            } else {
                if (i > 0) {
                    dp[i][j] += sum1[i - 1][j];
                }
                if (j > 0) {
                    dp[i][j] += sum2[i][j - 1];
                }
                if (i > 0 && j > 0) {
                    dp[i][j] += sum3[i - 1][j - 1];
                }
                sum1[i][j] = dp[i][j];
                sum2[i][j] = dp[i][j];
                sum3[i][j] = dp[i][j];
                if (i > 0) {
                    sum1[i][j] += sum1[i - 1][j];
                }
                if (j > 0) {
                    sum2[i][j] += sum2[i][j - 1];
                }
                if (i > 0 && j > 0) {
                    sum3[i][j] += sum3[i - 1][j - 1];
                }
            }
        }
    }
    out << dp[h - 1][w - 1] << '\n';
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solve(in, out);
    return 0;
}