#include <iostream>
using namespace std;

const int mxN = 1e3 + 4, mod = 1e9 + 7;
char grid[mxN][mxN];
long long dp[mxN][mxN];
int main() {
	int n, m;
	cin >> n >> m;
	for(int i = 1; i <= n; ++i)
		for(int j = 1; j <= m; ++j)
			cin >> grid[i][j];
	dp[1][1] = 1;
	for(int i = 1; i <= n; ++i) {
		for(int j = 1; j <= m; ++j)
			if(grid[i][j] != '#')
				dp[i][j] += (dp[i][j - 1] + dp[i - 1][j]) % mod;
	}
	cout << dp[n][m];
}
