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

char a[2005][2005];
ll dp[2005][2005][4];
int n,m;

int main(){
	cin>>n>>m;
	for(int i=1;i<=n;i++){
		cin>>(a[i]+1);
	}
    dp[1][1][0]=dp[1][1][1]=dp[1][1][2]=dp[1][1][3]=1;
	for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(i==1&&j==1||a[i][j]=='#')
                continue;
            dp[i][j][0]=(dp[i-1][j][1]+dp[i][j-1][2]+dp[i-1][j-1][3])%Mod;
            dp[i][j][1]=(dp[i-1][j][1]+dp[i][j][0])%Mod;
            dp[i][j][2]=(dp[i][j-1][2]+dp[i][j][0])%Mod;
            dp[i][j][3]=(dp[i-1][j-1][3]+ dp[i][j][0])%Mod;
        }
    }
    printf("%lld\n",dp[n][m][0]);
	return 0;
} 

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
ll ans = 0;
const ll mo = 1000000007;
auto mod = [](ll modx) {modx%=mo;modx+=mo;modx%=mo;return modx; };

int main()
{
ll h , w ;
cin >> h >> w ;
vector<vector<ll>> v(h, vector<ll>(w,0) );
vector<vector<ll>> vv(h, vector<ll>(w,0) );
vector<ll> vh(w,0);
vector<ll> vw(h,0);
vector<ll> vhw(h+w+1,0);

rep(i,h)rep(j,w){
  char a;
  cin >> a ;
  if(a=='#')v[i][j]=1;
}
vv[0][0]=1;
vw[0]=1;
vh[0]=1;
vhw[w]=1;
rep(i,h)rep(j,w){
  if(i==0&&j==0)continue;
  if(v[i][j]==1){
    vw[i]=0;
    vh[j]=0;
    vhw[w+i-j]=0;
  }
  else{
    vv[i][j]=mod(vw[i]+vh[j]+vhw[w+i-j]);
    vw[i]=mod(vw[i]+vv[i][j]);
    vh[j]=mod(vh[j]+vv[i][j]);
    vhw[w+i-j]=mod(vhw[w+i-j]+vv[i][j]);
  }
}
cout << vv[h-1][w-1] << endl;
return 0;
}