#include<bits/stdc++.h>
#define ll long long int
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpii vector< pii >
#define vpll vector< pll >
#define mpii map<int,int>
#define mpll map<ll,ll>
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define s(v) v.size()
#define test ll t;cin>>t;while(t--)
#define vec vector<ll>
#define read0(v,n) for(int i=0;i<n;i++)cin>>v[i];
#define read1(v,n) for(int i=1;i<=n;i++)cin>>v[i];
#define trav(a,x) for (auto& a: x)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define cut(x) {cout<<x;return 0;}
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORB(i,a,b) for(int i=a;i>=b;i--)

#define mp make_pair
#define pb push_back
#define eb emplace_back
#define f first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define nl '\n'
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
#define oset tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
ll gcd(ll a, ll b)
{
	if (b==0)return a;
	return gcd(b, a % b);
}
ll lcm(ll a,ll b)
{
    return (a*b)/gcd(a,b);
}
ll pow(ll a, ll b)
{
	ll ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%MOD;
		b/=2;
		a=(a*a)%MOD;
	}
	return ans;
}

const int N=2005;
ll a[N][N],row[N][N],col[N][N],dia[N][N];
char g[N][N];
int main()
{
	fast
	ll n,m;
    cin>>n>>m;
    FOR(i,1,n)
    {
        string s;
        cin>>s;
        FOR(j,1,m)
        {
            g[i][j]=s[j-1];
        }
    }
    FOR(i,1,n)
    {
        FOR(j,1,m)
        {
            if(i==1 and j==1){a[i][j]=0;row[i][j]=1;col[i][j]=1;dia[i][j]=1;continue;}
            if(g[i][j]=='#')
            {
                row[i][j]=0;col[i][j]=0;row[i][j]=0;
                a[i][j]=0;
            }
            else
            {
                ll x=0,y=0,z=0;
                if(i-1>=1)x=col[i-1][j];
                if(i-1>=1 and j-1>=1)y=dia[i-1][j-1];
                if(j-1>=1)z=row[i][j-1];
                a[i][j]=x+y+z;
                row[i][j]=a[i][j]+(j-1>=1?row[i][j-1]:0);
                col[i][j]=a[i][j]+(i-1>=1?col[i-1][j]:0);
                dia[i][j]=a[i][j]+(j-1>=1 and i-1>=1?dia[i-1][j-1]:0);
                row[i][j]%=MOD;
                col[i][j]%=MOD;
                dia[i][j]%=MOD;
                a[i][j]%=MOD;
            }
        }
    }
    
   // FOR(i,1,n)FOR(j,1,m)cout<<dp[i][j]<<(j==m?nl:' ');
    cout<<a[n][m];


}

#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
const int mod=1000000007;
inline int add(int x,int y)
{
	return ((ll)x+y)%mod;
}
bool g[2005][2005];
int dp[2005][2005],lr[2005][2005],tb[2005][2005],di[2005][2005];
int h,w;
int main()
{
	cin.tie(0);cout.tie(0);
	cin>>h>>w;
	for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
		{
			char c;
			cin>>c;
			if(c=='.') g[i][j]=1;
		}
	}
	dp[0][0]=1;
	lr[0][0]=1;
	tb[0][0]=1;
	di[0][0]=1;
	for(int i=1;i<w;i++)
		if(g[0][i]) 
		{
			dp[0][i]=lr[0][i-1];
			lr[0][i]=add(dp[0][i],lr[0][i-1]);
			tb[0][i]=dp[0][i];
			di[0][i]=dp[0][i];
		}
	int la;
	for(int i=1;i<h;i++)
	{
		if(g[i][0]) 
		{
			dp[i][0]=tb[i-1][0];
			tb[i][0]=add(tb[i-1][0],dp[i][0]);
			lr[i][0]=dp[i][0];
			di[i][0]=dp[i][0];
		}
		for(int j=1;j<w;j++)
			if(g[i][j]) 
			{
				dp[i][j]=add(add(tb[i-1][j],lr[i][j-1]),di[i-1][j-1]);
				tb[i][j]=add(tb[i-1][j],dp[i][j]);
				lr[i][j]=add(lr[i][j-1],dp[i][j]);
				di[i][j]=add(di[i-1][j-1],dp[i][j]);
			}
	}
	cout<<dp[h-1][w-1]<<endl;
	return 0;
}