// Slower C++ solution:
#define _CRT_SECURE_NO_WARNINGS

#include<bits/stdc++.h>

#include<iostream>

#include<algorithm>

#include<iomanip>

#include<string>

#include<cmath>

#include<vector>

#include<set>

#include<queue>

#include<stack>

#include<fstream>

#include<map>

#include<bitset>

#include<unordered_map>

#include<cstring>

#include<cctype>

using namespace std;

#define  ll long long

#define  ull unsigned long long

#define  ul unsigned long

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

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

#define pb(s) push_back(s);

#define format(n) fixed<<setprecision(n)

#define finl "\n"

#define Mohammed_Atef_Hassan fast();

#define mod 1000000007

#define INF LLONG_MAX

#define PI acos(-1)

#define clr(dp,n) memset(dp,n,sizeof dp)

#define ex(n) return cout<<n<<finl,0;

int dx[] = { 0, 1, 0, -1, 1, 1, -1, -1 };

int dy[] = { 1, 0, -1, 0, 1, -1, 1, -1 };

ll fix_mod(ll x, ll y)

{

	return (y + x % y) % y;

}

void fast() {

	std::ios_base::sync_with_stdio(false);

	cin.tie(nullptr); cout.tie(nullptr);

}

char g[1001][1001]; int n, m;

ll mem[1001][1001];

ll solve(int x, int y)

{

	if (x == n || y == m||g[x][y]=='#')return 0;

	if (x == n - 1 && y == m - 1)return 1;

	ll& ret = mem[x][y];

	if(~ret)return ret;

	 ret = solve(x + 1, y) + solve(x, y + 1);

	 return ret %= 1000000007;

}

int main()

{

	Mohammed_Atef_Hassan

		clr(mem, -1);

		cin >> n >> m;

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

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

			cin >> g[i][j];

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

}

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

#include <string>

#include<iomanip>

#include <algorithm>

#include <map>

#include <vector>

#include<queue>

#include<math.h>

#include<cmath>

#include<sstream>

#include<set>

#include <map>

#include<string.h>

#include<sstream>

#include<stack>

#include<unordered_map>

#include <iostream>

#include <stdio.h>

#include <stdlib.h>

#include <ctype.h>

#include <cstdio>

#include <cstdlib>

#include <complex>

#define ll long long

#define  point complex<double>

#define  pi acos(-1)

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

#define arr2dof vector  vector<vector<int>>dp(N,vector<int>(2, inf));

using namespace std;

const ll N = 2e5 + 5, mod = 1e9 + 7, inff = -1e12,inf=1e9+7;

const double ep = 0.0000000001;

//const double pi = 3.14159265359;



double dot(point a, point b) {

	return  (conj(a)*b).real();

}

double cross(point a, point b) {

	return  (conj(a)*b).imag();

}

double angle(point a, point b)

{

	double dt = dot(a, b);

	dt /= abs(a);

	dt /= abs(b);

	return acos(dt) * 180.0 / pi;

}



bool isrightangel(int ind) {//90 degree

	vector<point>v;

	return(angle(v[ind] - v[(ind + 1) % 3], v[ind] - v[(ind + 2) % 3]) == 90);//bshof hal eldot producty3ny fe

	//dl3en 3moden 3ashn yb2a right trinagle

}



ll fact[1000006], inv[1000006];



ll fp(ll base, ll exp)

{

	if (exp == 0)

		return 1;

	ll ans = fp(base, exp / 2);

	ans = (ans * ans) % mod;

	if (exp % 2 != 0)

		ans = (ans * (base % mod)) % mod;

	return ans;

}



void calcFacAndInv(ll n)

{

	fact[0] = inv[0] = 1;

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

	{

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

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

	}

}



ll ncr(ll n, ll r)

{

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

}



ll npr(ll n, ll r)

{

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

}

	







char arr[1005][1005];

int dp[1005][1005];

int h, w;





int main()

{

	cin >> h >> w;

	for (int i = 0; i < h; ++i) {

		for (int l = 0; l < w; ++l) {

			cin >> arr[i][l];

		}

	}

	dp[0][0] = 1;

	for (int i = 0; i < h; ++i) {

		for (int l = 0; l < w; ++l) {

			if (i == 0 && l == 0)

				continue;

			else if (arr[i][l] == '#')

				dp[i][l] = 0;

			else {

				if (i - 1 >= 0)

					dp[i][l] = dp[i - 1][l] ;

				else

					dp[i][l] = 0;

				if (l- 1 >= 0)

					dp[i][l] += dp[i][l-1] ;

				dp[i][l] %= mod;

					

			}

		}

	}

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

	return 0;

}