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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;


#define imx INT_MAX
#define imn INT_MIN
#define llmx LLONG_MAX
#define llmn LLONG_MIN
#define INF         100000000000000000
#define PI          3.1415926535897932384626433832795l



#define fi first
#define se second
#define pb push_back
#define f_s(a) sort(a.begin(), a.end())
#define b_s(a) sort(a.rbegin(), a.rend())
#define p(a) cout<<a<<"\n"


// ll mod = 1000000007;
// #define l(i, )
// #define rl(i, a, b) for(int i = a; i < b; i++)






// struct mycomp {
//     bool operator() (const pair<int,int> &a, const pair<int,int> &b) const{
//         if (a.second-a.first != b.second-b.first)
//         return (a.second-a.first > b.second-b.first);
//         return a.first < b.first;
//     }
// };



/////////////////////GCD//////////////////////
ll gcd(ll a, ll b)
{
	if(b==0) return a;
	return gcd(b, a%b);
}


ll extended_gcd(ll a, ll b, ll& x, ll& y)
{
	if(b==0)
	{
		x=1;
		y=0;
		return a;
	}
	ll x1, y1;
	ll d = extended_gcd(b, a%b, x1, y1);
	x=y1;
	y=x1-y1*(a/b);
	return d;
}

////////////////////SIEVE OF ERATOSTHENES//////////////////////
vector<int> sieveoferatosthenes(int n)
{
	vector<bool> prime(n+1, true);
	for(int i = 2; i <= sqrt(n); i++)
	{
		if(prime[i])
		{
			for(int j = i*i; j<=n; j+=i)
			{
				prime[j]=false;
			}
		}
	}
	vector<int> all_primes;
	for(int i = 2; i <=n; i++)
	{
		if(prime[i]) all_primes.pb(i);
	}
	return all_primes;
}

////////////////////BINARY EXPONENTIATION///////////////////////
ll bin_exp(ll a, ll b, ll mod)
{
	ll ans = 1;
	while(b)
	{
		if(b%2)
		{
			b--;
			ans = (ans%mod*a%mod)%mod;
		}
		b/=2;
		a = (a%mod*a%mod)%mod;
	}
	return ans;
}


///////////////////////////BFS//////////////////////////////////
void bfs(vector<int>& distance, vector<int> a[], vector<bool>& visited, int u, vector<int>& parent)
{
	visited[u]=true;
	parent[u]=-1;
	distance[u]=0;
	queue<int> q;

	q.push(u); 
    while (!q.empty()) { 
  
        int f = q.front(); 
        q.pop(); 
  		for(int i =0; i < a[f].size(); i++)
  		{
  			if(visited[a[f][i]]==false)
  			{
  				distance[a[f][i]]=distance[f]+1;
  				parent[a[f][i]]=f;
  				visited[a[f][i]]=true;
  				q.push(a[f][i]);
  			}
  		}
    } 

}

void solve()
{
	int n, m;
	cin>>n>>m;
	ll mod = 1000000007;
	vector<string> s(n);
	vector<vector<ll> > dp(n, vector<ll> (m));
	for(int i = 0; i < n; i++)
	{
		cin>>s[i];
	}

	// for(int i = 0; i < n; i++) dp[0][i]=-1;
	// for(int i = 0; i < n; i++) dp[i][0]=-1;
	// for(int i = 0; i < n; i++)
	// {
	// 	for(int j = 0; j < n; j++)
	// 	{
	// 		if(s[i][j]=='*')
	// 			dp[i][j]=-1;
	// 	}
	// }
	// for(int i = 0; i < n; i++)
	// {
	// 	if(s[i][0]=='.') dp[i][0]=1;
	// 	else break;
	// }
	// for(int i = 0; i < n; i++)
	// {
	// 	if(s[0][i]=='.') dp[0][i]=1;
	// 	else break;
	// }

	// for(int i = 1; i < n; i++)
	// {
	// 	for(int j = 1; j < n; j++)
	// 	{
	// 		if(dp[i][j]!=-1)
	// 		{
	// 			if(dp[i-1][j]!=-1) dp[i][j]=dp[i-1][j]%mod;
	// 			if(dp[i][j-1]!=-1) dp[i][j] = (dp[i][j]%mod+dp[i][j-1]%mod)%mod;
	// 		}
	// 	}
	// }

	if(s[0][0]=='.') dp[0][0]=1;
	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < m; j++)
		{
			if(s[i][j]=='#') continue;
			if(i>0) dp[i][j]=(dp[i][j]%mod+dp[i-1][j]%mod)%mod;
			if(j>0) dp[i][j]=(dp[i][j]%mod+dp[i][j-1]%mod)%mod;
		}
	}
	p(max(0ll, dp[n-1][m-1]));
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	// #ifndef ONLINE_JUDGE
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	// #endif
	solve();
	return 0;
}	

Measured memory_bytes: 9216