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

using ll = long long;

//constant
const ll MOD = 1e+9 + 7;
const double EPS = 1e-10;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, s, e) for (ll i = s; i < e; i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(), (x).rend()

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

// view vector
template<typename T> void view(T e) { std::cout << e << std::endl; }
template<typename T> void view(const std::vector<T>& v) { for (const auto& e : v) { std::cout << e << " "; } std::cout << std::endl; }
template<typename T> void view(const std::vector<std::vector<T> >& vv) { for (const auto& v : vv) { view(v); } }

// DP
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

#include <iostream>

using namespace std;

template<typename Int, Int mod>
class ModInt {
public:
	static const Int Mod = mod;
	Int x;
	ModInt() { x = 0; }
	ModInt(int a) { Int t = a % mod; if (t < 0) t += mod; x = t; }
	ModInt(long long a) { Int t = a % mod; if (t < 0) t += mod; x = t; }
	Int get() const { return x; }

	ModInt& operator += (ModInt that) { if ((x += that.x) >= mod) x -= mod; return *this; }
	ModInt& operator -= (ModInt that) { if ((x += mod - that.x) >= mod) x -= mod; return *this; }
	ModInt& operator *= (ModInt that) { x = (long long)(x)*that.x % mod; return *this; }
	bool operator == (ModInt that) const { return x == that.x; }
	ModInt operator + (ModInt that) const { return ModInt(*this) += that; }
	ModInt operator - (ModInt that) const { return ModInt(*this) -= that; }
	ModInt operator * (ModInt that) const { return ModInt(*this) *= that; }
	ModInt operator - () const { return ModInt(-this->x); }
	inline friend ostream& operator << (ostream& out, ModInt m) { return out << m.x; }

	ModInt power(long long k) const {
		ModInt r(1); ModInt b = *this;
		if (k <= 0) return r;
		while (k) { if (k & 1) r *= b; b *= b; k >>= 1; }
		return r;
	}
	ModInt inverse() const {
		long long a = x, b = mod, u = 1, v = 0;
		while (b) { long long t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); }
		return ModInt(u);
	}
};

#define MOD (1000000007)
typedef ModInt<int, MOD> Mint;

// ***************************************

vector<vector<Mint>> dp;
vector<vector<bool>> visited;
vector<vector<char>> table;
int H, W;

Mint rec(pair<int, int> cell) {
	int y = cell.first;
	int x = cell.second;
	if (visited[y][x]) {
		return dp[y][x];
	}

	visited[y][x] = true;
	Mint ret = 0;
	if (y < H - 1 && table[y + 1][x] == '.') ret += rec({ y + 1, x });
	if (x < W - 1 && table[y][x + 1] == '.') ret += rec({ y, x + 1 });
	dp[y][x] = ret;

	return ret;

}


int main(void) {

	cin >> H >> W;
    table.assign(H, vector<char>(W));
	for (auto& col : table) {
		for (auto& cell : col) {
			cin >> cell;
		}
	}

	visited.assign(H, vector<bool>(W));
	dp.assign(H, vector<Mint>(W));
	dp[H - 1][W - 1] = 1;
	visited[H - 1][W - 1] = true;

	Mint ans = rec({ 0, 0 });

	cout << ans.get() << endl;
	
	return 0;
}

Measured memory_bytes: 5504