#include <bits/stdc++.h>
using namespace std;
#define int int64_t
#define MAX 1005
#define MOD 1000000007
int dp[MAX][MAX];
signed main()
{
	int h,i,j,w;
	cin>>h>>w;
	string s[h];
	for(i=0;i<h;i++)
	cin>>s[i];
	dp[0][0]=1;
	for(i=0;i<h;i++)
	for(j=0;j<w;j++)
	{
		if(i>0&&s[i-1][j]=='.')
		dp[i][j]=(dp[i-1][j]+dp[i][j])%MOD;
		if(j>0&&s[i][j-1]=='.')
		dp[i][j]=(dp[i][j]+dp[i][j-1])%MOD;	
    }
    cout<<dp[h-1][w-1]<<"\n";
}