#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;
ll n,m,dp[1005][1005];
char s;
int main()
{
    cin>>n>>m;
    dp[0][1]=1;
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
    {
        cin>>s;
        if(s=='.')
            dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod;
        else dp[i][j]=0;
    }
    cout<<dp[n][m];
}
