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

#define pb push_back
#define sz size

const int N = 1e3 + 123, MOD = 1e9 + 7;
int n, m, dp[N][N];
char a[N][N];

int main() {
	//freopen("input.txt", "r", stdin);
	cin >> n >> m;
	dp[0][1] = 1;
	for(int i = 1; i <= n; ++i) {
		for(int j = 1; j <= m; ++j) {
			cin >> a[i][j];
			if(a[i][j] == '.') {
				dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % MOD;
			}
		}
	}
	cout << dp[n][m];
}