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

const int P = 1000000007;

int n, m, f[1005][1005];
char mp[1005][1005];

int main() {
	scanf("%d%d", &n, &m);
	for (int i = 0; i < n; ++ i) scanf("%s", mp[i]);
	f[0][0] = 1;
	for (int i = 0; i < n; ++ i)
		for (int j = 0; j < m; ++ j) {
			if (mp[i][j] == '.') {
				if (i > 0) f[i][j] = (f[i][j] + f[i - 1][j]) % P;
				if (j > 0) f[i][j] = (f[i][j] + f[i][j - 1]) % P; 
			}
		}
	printf("%d\n", f[n - 1][m - 1]);
	return 0;
}
