#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll mod = 1e9 + 7;

int main()
{
	int W, H;
	cin >> H >> W;
	vector<string> mass(H);
	for (int i = 0; i < H; i++)
	{
		cin >> mass[i];
	}

	vector<vector<ll>> dp(H, vector<ll>(W, 0)), Xs(H, vector<ll>(2222, 0)), Ys(H, vector<ll>(W, 0)), Zs(H, vector<ll>(W, 0));
	dp[0][0] = 1;
	Xs[0][0] = 1, Ys[0][0] = 1, Zs[0][0] = 1;
	for (int i = 0; i < H; i++)
	{
		for (int j = 0; j < W; j++)
		{
			if (i == 0 && j == 0)
				continue;
			if (mass[i][j] == '#')
			{
				dp[i][j] = 0, Xs[i][i] = 0, Ys[i][j] = 0, Zs[i][j] = 0;
				continue;
			}

			if (j > 0)
				dp[i][j] += Xs[i][j - 1];
			if (i > 0)
				dp[i][j] += Ys[i - 1][j];
			if (i > 0 && j > 0)
				dp[i][j] += Zs[i - 1][j - 1];
			dp[i][j] %= mod;
			Xs[i][j] += dp[i][j], Ys[i][j] += dp[i][j], Zs[i][j] += dp[i][j];
			if (j > 0)
				(Xs[i][j] += Xs[i][j - 1]) %= mod;
			if (i > 0)
				(Ys[i][j] += Ys[i - 1][j]) %= mod;
			if (i > 0 && j > 0)
				(Zs[i][j] += Zs[i - 1][j - 1]) %= mod;
		}
	}

	cout << dp[H - 1][W - 1] << "\n";
}

// Problem : E - Queen on Grid
// Contest : AtCoder - AtCoder Beginner Contest 183
// URL : https://atcoder.jp/contests/abc183/tasks/abc183_e
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

// God & me
// Fly ...
//#pragma GCC optimize "trapv"//  WA to RE int!!
#include <bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<n;i++)
#define FORR(i,n) for(int i=n;i>=0;i--)
#define pb push_back
#define vint vector<int>
#define sint set<int>
#define mint map<int,int>
#define pint pair< int,int >
#define int long long int 
#define test int tt1234; cin>>tt1234;while(tt1234--)
#define endl "\n"
#define input(a,n) int n;cin>>n;vint a(n);for(int&v:a)rd(v);
#define all(zz) zz.begin(),zz.end()
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define error(x) cerr << #x <<" is " << x << endl;
#define Error(a,b) cerr<<"( "<<#a<<" , "<<#b<<" ) = ( "<<(a)<<" , "<<(b)<<" )\n";
#define precision(x) cout<<fixed<<setprecision(x);
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define present(container, element) (container.find(element)!=container.end())
#define fint fast;test
#define set(a,x) memset(a,x,sizeof(a))
#define L(x)	((x)<<1)
#define R(x)	(((x)<<1)+1)
#define ft first
#define se second
#define MOD 1000000007
using namespace std;
template<typename... T> void rd(T&... args) { ((cin >> args), ...); }
template<typename... T> void pp(T... args) { ((cout << args << " "), ...); cout<<"\n"; }

int n,m;
int arr[3001][3001];
int dp[2005][2005];

int go(int x,int y)
{
	if(x==n-1 && y==m-1) return 1;
	if(x>=n || y>=m) return 0;
	int ans=0;
	
	if(dp[x][y]!=-1) return dp[x][y]%MOD;
	for(int i=x+1;i<n;i++)
	{
		if(arr[i][y]==1)break;
		ans=(ans%MOD+go(i,y)%MOD)%MOD;
	}
	
	for(int j=y+1;j<m;j++)
	{
		if(arr[x][j]==1)break;
		ans=(ans%MOD+go(x,j)%MOD)%MOD;
	}
	
	for(int i=1;;i++)
	{
		int X=x+i,Y=y+i;
		if(X>=n || Y>=m || arr[X][Y]==1)break;
		ans=(ans%MOD+go(X,Y)%MOD)%MOD;
	}
	
	return dp[x][y]=ans%MOD;	
}


void solve(){
	rd(n,m);
	rep(i,1,n+1){
		rep(j,1,m+1){
			char c;
			rd(c);
			arr[i][j]=(c=='.')?0:1;
		}
	}
	int U[n+1][m+1]={0},D[n+1][m+1]={0},DG[n+1][m+1]={0};
	dp[1][1]=1;
	U[1][1]=1;
	D[1][1]=1;
	DG[1][1]=1;
	int con=1;
	rep(j,2,m+1)
	{
		if(arr[1][j]==1)break;
		else dp[1][j]=con%MOD,con+=dp[1][j]%MOD;
		U[1][j]=dp[1][j]%MOD;
		D[1][j]=dp[1][j]%MOD;
		DG[1][j]=dp[1][j]%MOD;
	}	
	con=1;
	rep(i,2,n+1)
	{
		if(arr[i][1]==1)break;
		else
		{
			dp[i][1]=con%MOD,con+=dp[i][1]%MOD;
			U[i][1]=dp[i][1]%MOD;
			D[i][1]=dp[i][1]%MOD;
			DG[i][1]=dp[i][1]%MOD;
		}
	}
	
	for(int i=2;i<=n;i++)
	{
		for(int j=2;j<=m;j++)
		{
			if(arr[i][j]==1)dp[i][j]=0;
			else
			{
				dp[i][j]=(U[i-1][j]%MOD+D[i][j-1]%MOD+DG[i-1][j-1]%MOD)%MOD;
				U[i][j]=(U[i-1][j]%MOD+dp[i][j]%MOD)%MOD;
				D[i][j]=(D[i][j-1]%MOD+dp[i][j]%MOD)%MOD;
				DG[i][j]=(DG[i-1][j-1]%MOD+dp[i][j]%MOD)%MOD;
			}
		}
	}	
	
	// rep(i,1,n+1){
		// rep(j,1,m+1){
			// cout<<dp[i][j]<<" ";
		// }
		// cout<<endl;
	// }
	pp(dp[n][m]%MOD);
	return;	
}


int32_t main() {
    fast;
    // memset(dp,-1,sizeof(dp));
    solve();
    return 0;
}