#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mx=1001,mod =1e9+7;
ll dp[mx][mx];
int main()
{
    int h,w;
    char ch;
    cin>>h>>w;
    dp[1][0]=1;
    for(int i=1; i<=h; i++)
    {
        for(int j=1; j<=w; j++)
        {
            cin>>ch;
            if(ch=='.')
                dp[i][j] = dp[i-1][j] + dp[i][j-1];
            dp[i][j]%=mod;
        }
    }
    cout<<dp[h][w]<<endl;
}
