// Slower C++ solution:
#define _CRT_SECURE_NO_WARNINGS

#include<bits/stdc++.h>

#include<unordered_map>

#include<unordered_set>	

using namespace std;

#define all(v)			((v).begin()), ((v).end())

#define sz(v)			((int)((v).size()))

#define clr(v, d)		memset(v, d, sizeof(v))

#define rep(i, v)		for(int i=0;i<sz(v);++i)

#define lp(i, n)		for(int i=0;i<(int)(n);++i)

typedef long long         ll;

const double EPS = (1e-7);

int dcmp(double x, double y) { return fabs(x - y) <= EPS ? 0 : x < y ? -1 : 1; }

#define pb					push_back

#define P(x)				cout<<#x<<" = { "<<x<<" }\n"

clock_t T;

#define ctime cerr << "Time : " << double(clock() - T) / CLOCKS_PER_SEC << endl

void GOAT()

{

	std::ios_base::sync_with_stdio(0);

	cin.tie(NULL);

	cout.tie(NULL);

#ifndef ONLINE_JUDGE

	freopen("in.txt", "r", stdin);

	//freopen("output.txt", "w	", stdout);

#else

#endif



}

int r, c;

char grid[1007][1007];

int mem[1007][1007];

bool valid(int i, int j)

{

	return (i < r && j < c);

}

const int m = 1e9 + 7;

int solve(int i, int j)

{

	if (i == r - 1 && j == c - 1)return 1;

	int& ret = mem[i][j];

	if (~ret)return ret;

	ret = 0;

	if (valid(i, j + 1) && grid[i][j + 1] != '#')ret=((ret%m)+(solve(i, j + 1)%m))%m;

	if (valid(i + 1, j) && grid[i + 1][j] != '#')ret = ((ret % m) + (solve(i+1, j) % m)) % m;

	return ret%m;

}

int main() {

	//GOAT();

	

		clr(mem, -1);

		cin >> r >> c;

		for (int i = 0; i < r; i++)

		{

			for (int j = 0; j < c; j++)

			{

				cin>>grid[i][j];

			}

		}

		cout << solve(0, 0) << endl;

}

// Faster C++ solution for the same problem (measured speedup: 5.096513356885255x):
#include <iostream>

#include <stdio.h>

#include <string>

#include <cstring>

#include <cstdio>

#include <algorithm>

#include <cmath>

#include <vector>

#include <set>

#include <map>

#include <queue>

#include <deque>

#include <stack>

#include <bitset>

#include <iomanip>



#define ll long long

#define ld long double

#define ull unsigned long long

#define endl "\n"

#define MohamedMotaz ios::sync_with_stdio(0); cin.tie(0); ios_base::sync_with_stdio(0);

#define f(a, b, c) for(int a = b; a < c; a++)

using namespace std;





//ll fact[1000001]; ll inv[1000001];

//ll primes[100007];

//ll arr[1000007];

//ll modPower(ll b, ll p) {

//	if (p == 0)

//		return 1;

//

//	ll halfpow = modPower(b, p / 2);

//	ll toReturn = (halfpow * halfpow) % mod;

//	if (p % 2)

//		toReturn = (toReturn * b) % mod;

//

//	return toReturn;

//}

//

//ll fastPower(ll b, ll p) {

//	if (p == 0)

//		return 1;

//	ll ans = fastPower(b, p / 2);

//	ans = (ans * ans);

//	if (p % 2 != 0)

//		ans = (ans * b);

//	return ans;

//}

//ll GcdRecursive(ll a, ll b) {

//	if (b == 0) return a;

//	return GcdRecursive(b, a % b);

//}

//ll modLCM(ll a, ll b) {

//	ll val = GcdRecursive(a, b);

//	ll tmp = ((a % mod) * (b % mod)) % mod;

//	ll finalVal = ((tmp % mod) * (arr[val] % mod)) % mod;

//	return finalVal;

//

//}

//ll LCM(ll a, ll b) {

//	return (a * b) / GcdRecursive(a, b);

//}

//void move1step(ll& a, ll& b, ll q) { // a and b by reference

//	ll c = a - q * b;

//	a = b;

//	b = c;

//}

//ll GcdIterative(ll a, ll b) {

//	while (b) move1step(a, b, a / b);

//	return a;

//}

//

//void pre(ll n) {

//

//	fact[0] = 1;

//	inv[0] = 1;

//

//	for (ll i = 1; i <= n; i++) {

//		fact[i] = (i * fact[i - 1]) % mod;

//		inv[i] = modPower(fact[i], mod - 2);

//		arr[i] = modPower(i, mod - 2);

//	}

//}

//

//ll npr(ll n, ll r) {

//	return ((fact[n] * inv[n - r]) % mod);

//}

//

//ll ncr(ll n, ll r) {

//	return ((((fact[n] * inv[n - r]) % mod) * inv[r]) % mod);

//}

//

//void sieve(ll val) {

//	memset(primes, 1, sizeof primes);

//	primes[0] = primes[1] = false;

//	for (int i = 2; i <= val; i++) {

//		if (primes[i]) {

//			for (int j = i * i; j <= val; j += i) {

//				primes[j] = 0;

//			}

//		}

//	}

//

//}



const ll mod = 1e9 + 7;

const ll N = 1e5 + 7;



ll h,w;

char c;

ll dp[1007][1007] = {};





int main()

{

    MohamedMotaz;



    cin >> h >> w;

    dp[0][0] = 1;

    f(i,0,h){

        f(j,0,w){

            cin >> c;

            if (c == '#') continue;

            //cout << "now at: " << i << " " << j << endl;

            if (i - 1 >= 0) dp[i][j] += dp[i - 1][j];//, cout << "yaya" << endl;

            if (j - 1 >= 0) dp[i][j] += dp[i][j - 1];//, cout << "yayayyaa" << endl;

            dp[i][j] %= mod;

        }

    }



    cout << dp[h - 1][w - 1];







}