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

const int mod=1e9+7;
int n, m, dp[1002][1002];
string grid[1002];

int main(){
	memset(dp,0,sizeof dp);
	cin >> n >> m;
	for (int i=0;i<n;i++) cin >> grid[i];
	dp[0][0]=1;
	for (int i=0;i<n;i++){
		for (int j=0;j<m;j++){
			if (grid[i][j]=='.'){
				dp[i+1][j]+=dp[i][j];
				dp[i+1][j]%=mod;
				dp[i][j+1]+=dp[i][j];
				dp[i][j+1]%=mod;
			}
		}
	}
	cout << dp[n-1][m-1] << "\n";
}