// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

#define print printf("==================\n")

#define ll long long

#define pi acos(-1.0)

#define eps 1e-16

#define max3(a,b,c) max(a,max(b,c))

const ll INF = 1 << 30;

#define mod 1000000007

typedef pair<double, double  > payar;

typedef struct

{

    ll  x, y;

} point;

priority_queue<payar, vector<payar>,  greater<payar> > pq; ///accending

vector< pair<double,payar  > > vpp;

vector < payar >  vp;

char ara[1006][1006];

ll dp[1006][1005];

int n, m ;

ll cal(int i, int j )

{

    if(i>n or j>m )

        return 0;

    if(i==n and j==m)

        return 1;

    if(ara[i][j]=='#')

        return 0 ;

    if(dp[i][j]!=-1)

        return dp[i][j]%mod;

    return dp[i][j]= (cal(i+1,j)%mod+cal(i,j+1)%mod)%mod;





}

int main()

{





    cin>>n>>m;

    memset(dp,-1,sizeof dp);

    for(int i = 1 ; i<=n ; i++)

    {

        for(int j = 1 ; j<=m ; j++)

        {

            cin>>ara[i][j];

        }

    }

    cout<<cal(1,1);



    return  0 ;

}


// Faster C++ solution for the same problem (measured speedup: 9.383387325605218x):
#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];







}