using namespace std;
#include<iostream>
#include<vector>
#include<queue>
#include<map>
#include <unordered_set>
#include <set>
#include <unordered_map>
#include<stack>

#define MOD1e9 1000000007
#define INT_MAX       2147483647
#define INT_MIN     (-2147483647 - 1)
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define rep(c) for(int i = 0; i <(c); ++i)
#define rrep(n) for(int i = (n) ; i >=0 ; --i)
#define fora(i, s, c) for(int i = (s); i < (c); ++i)
#define forr(i, s, c) for(int i = (s); i > (c); --i)
#define endl "\n"
#define ret(n) return n
#define pb push_back
#define eb emplace_back
#define ff first;
#define ss second;
#define mp make_pair;
#define all(p) p.begin(),p.end()
#define mid(s,e) (s+(e-s)/2)
//Typedefs
typedef long long ll;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef priority_queue<int> pqint;
typedef priority_queue<ll> pqll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<long> vl;
typedef vector<vl> vvl;
typedef vector<bool> vb;
//Testcase start
#define tcs() int testcases; cin >> testcases; while(testcases--)
//Functions
inline int twop(int n) { return 1 << n; }
template<class T> T gcd(T a, T b) { if (b == 0)return a; return gcd(b, a % b); }
template<class T> T lcm(T a, T b) { return (a * b) / gcd(a, b); }
ll ctnum(char c) { if (c == '0') return 0; else if (c == '1') return 1; else if (c == '2') return 2; else if (c == '3') return 3; else if (c == '4') return 4; else if (c == '5') return 5; else if (c == '6') return 6; else if (c == '7') return 7; else if (c == '8') return 8; else if (c == '9') return 9; }
ll power(ll n, ll exp , ll MOD)
{
	if (exp == 0)
		return 1;
	ll temp = power(n, exp / 2 ,MOD);
	if (exp % 2 == 0)
		return ((temp % MOD) * (temp % MOD)) % MOD;
	else
		return ((n % MOD) * (temp % MOD) * (temp % MOD)) % MOD;
}
ll mod(int x, int m)
{
	return ((x % m + m) % m);
}

ll countways(int x, int y, vvi& arr, vvll& dp)
{
	if (x >= arr.size() || y >= arr[0].size() || arr[x][y] == 1)
		return 0; //cannot go further

	if (x == arr.size() - 1 && y == arr[0].size() - 1)
		return 1; //reached

	ll &ans = dp[x][y];
	if (ans != -1)
		return ans;
	ll moveright = countways(x, y + 1, arr, dp);
	ll movedown = countways(x + 1, y, arr, dp);
	ans = mod(moveright, MOD1e9) + mod(movedown, MOD1e9);
	ans = mod(ans, MOD1e9);
	return ans;
}
//iterative
//0 means ok, 1 means wall
ll countways(vvi& arr)
{
	vvll dp(arr.size(), vll(arr[0].size(), 0));

	//initialise first row and first col of dp
	//row
	fora(i, 0, arr[0].size())
	{
		if (arr[0][i] != 1) //no wall
			dp[0][i] = 1;
		else
			break; //cannot move ahead
	}
	//col
	fora(i, 0, arr.size())
	{
		if (arr[i][0] != 1)
			dp[i][0] = 1;
		else
			break;
	}
	fora (i, 1, arr.size())
	{
		fora(j, 1, arr[0].size())
		{
			if (arr[i][j] != 1)
			{
				if (arr[i - 1][j] != 1)
					dp[i][j] += dp[i - 1][j];
				dp[i][j] = mod(dp[i][j], MOD1e9);
				if (arr[i][j - 1] != 1)
					dp[i][j] += dp[i][j - 1];
				dp[i][j] = mod(dp[i][j], MOD1e9);
			}
		}
	}
	return dp[arr.size() - 1][arr[0].size() - 1];
}
int main()
{
	int x, y;
	cin >> x >> y;
	vvi a(x, vi(y));
	fora(i, 0, x)
	{
		fora(j, 0, y)
		{
			char c;
			cin >> c;
			a[i][j] = (c == '.' ? 0 : 1);
		}
	}
	//vvll dp(x, vll(y, -1));
	//ll ans = countways(0, 0, a, dp);
	ll ans = countways(a);
	cout << ans;
	ret(0);
}

Measured memory_bytes: 12032