#include <bits/stdc++.h>
#include <numeric>
#include <iomanip>
#define ll long long
#define intm INT_MAX
#define llm LLONG_MAX
 
using namespace std;
typedef array<ll, 2> P;
const int mod = 1e9 + 7;
//const ll mod = 1e9 + 7;
const int mxN = 2e5 + 9;
const int INF = 2e9; 

/*
 (x1,y1) (x,0) (x2,y2)
 y1/(x-x1) = y2/(x2-x)
 y1*(x2-x) = y2(x-x1)
 y1x2 - y1*x = y2*x - y2x1
 x = (y1x2 + y2x1)/(y1+y2)
 */
 
char a[2009][2009];
int dp[2009][2009];
int	x[2009][2009];
int y[2009][2009];
int z[2009][2009];

void solve(){
	int h,w;
	cin >> h >> w;
	for(int i=1; i <= h; i++){
		for(int j=1; j <= w; j++){
			cin >> a[i][j];
		}
	}
	dp[1][1] = 1;
	x[1][1] = 1; y[1][1] = 1; z[1][1] = 1;
	for(int i=1; i <= h; i++){
		for(int j=1; j <= w; j++){
			if(i==1&&j==1) continue;
			if(a[i][j]=='#'){
				x[i][j] = 0; y[i][j] = 0; z[i][j] = 0;
				continue;
			}
			if( 1 <= j-1 && j-1 <= w) dp[i][j] = (dp[i][j] + x[i][j-1]) % mod;
			if( 1 <= i-1 && i-1 <= h) dp[i][j] = (dp[i][j] +y[i-1][j]) % mod;
			if( 1 <= i-1 && i-1 <= h && 1 <= j-1 && j-1 <= w) dp[i][j] = (dp[i][j] + z[i-1][j-1]) % mod;
			//update x y z
			//cout << i << " " << j << " " << x[i-1][j] << " " << dp[i][j] << '\n';
			x[i][j] = (x[i][j-1] + dp[i][j]) % mod;
			y[i][j] = (y[i-1][j] + dp[i][j]) % mod;
			z[i][j] = (z[i-1][j-1] + dp[i][j]) % mod;
			
		}
	}
	cout << dp[h][w] << '\n';
	/*for(int i=1; i <= h; i++){
		for(int j=1; j <= w; j++){
			cout << dp[i][j] << " ";
		}
		cout << endl;
	}
	cout << "-----------------\n";
	for(int i=1; i <= h; i++){
		for(int j=1; j <= w; j++){
			cout << x[i][j] << " ";
		}
		cout << endl;
	}*/
}
 
int main(){
	ios_base::sync_with_stdio(false); cin.tie(0);
	int t;
	t = 1;
	//cin >> t;
	while(t--){
		solve();
	} 
}


#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <list>
#include <ctime>
#include <sstream>
#include <queue>
#include <stack>
#include <random>
#include <bitset>
#include <numeric>
#include <cassert>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
#define rep(x, b, e) for(int x=(b); x<(e); ++x)
#define ford(x, b, e) for(int x=((int)(b))-1; x>=(e); --x)
#define all(c) c.begin(),c.end()
#define sz(x) ((int)((x).size()))
#define pb push_back
#define st first
#define nd second
#define mp(x,y) make_pair(x,y)
typedef short int sint;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it) {
	*this << ((it != d.b) ? ", " : "") << *it;
  }
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

const int mod = 1e9 + 7;

int modu(ll x) {
	if (x >= mod) {
		x %= mod;
	}
	return x;
}

int main() {
	ios_base::sync_with_stdio(false);
	int h, w;
	cin >> h >> w;
	vector<string> t(h);
	rep(i, 0, h) {
		cin >> t[i];
		// t[i] = string(w, '.');
	}
	vector<vi> up(h, vi(w)), left(h, vi(w)), diag(h, vi(w));
	vector<vi> f(h, vi(w));
	f[0][0] = up[0][0] = left[0][0] = diag[0][0] = 1;
	rep(i,0,h) rep(j,0,w) {
		if (i +j == 0) {
			continue;
		}
		if (t[i][j] == '#') {
			continue;
		}
		f[i][j] = modu((ll)(i > 0 ? up[i-1][j] : 0) + (j > 0 ? left[i][j-1] : 0) + (i>0&&j>0 ? diag[i-1][j-1] : 0));
		up[i][j] = modu((i > 0 ? up[i-1][j] : 0) + f[i][j]);
		left[i][j] = modu((j > 0 ? left[i][j-1] : 0) + f[i][j]);
		diag[i][j] = modu((i>0&&j>0 ? diag[i - 1][j - 1] : 0) + f[i][j]);
	}
	cout << f[h-1][w-1] << endl;
}