//always use
#include <bits/stdc++.h>
using namespace std;
#define forn(i, n) for(int i=0; i<n; i++)
#define mp make_pair
#define pb push_back
#define f first
#define s second
typedef long long ll;
#define MOD 1000000007
#define HASHMOD 1275341791
//2 147 483 647 (2^31-1) int max
//9 223 372 036 854 775 807 (2^63-1) ll max

//codeforces and USACO
void fast_io(){
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);}

//USACO
void file_io(string taskname){
  string fin = taskname + ".in";
  string fout = taskname + ".out";
  const char* FIN = fin.c_str();
  const char* FOUT = fout.c_str();
  freopen(FIN, "r", stdin);
  freopen(FOUT, "w", stdout);
  fast_io();}

//Printing pairs and vectors
template<typename A, typename B> ostream& operator<<(ostream &cout, pair<A, B> const &p) { return cout << "(" << p.f << ", " << p.s << ")"; }
template<typename A> ostream& operator<<(ostream &cout, vector<A> const &v) {
cout << "["; for(int i = 0; i < v.size(); i++) {if (i) cout << ", "; cout << v[i];} return cout << "]";}

//main code
int main(){
  fast_io();
  int n,m;
  cin >> n >> m;
  vector<vector<int>>a(n,vector<int>(m));
  forn(i,n){
    string s;
    cin >> s;
    forn(j,m){
      if (s.at(j)=='.'){
        a[i][j]=1;
      }
    }
  }
  vector<ll>diag(n+m-1,0);
  vector<ll>vert(m,0);
  forn(i,n){
    ll hor=0;
    forn(j,m){
      if (a[i][j]==1){
        ll x=0;
        if (i==0 and j==0){
          x++;
        }
        x=(x+diag[i-j+m-1])%MOD;
        x=(x+hor)%MOD;
        x=(x+vert[j])%MOD;
        if (i==n-1 and j==m-1){
          cout << x <<" ";
        }
        diag[i-j+m-1]=(diag[i-j+m-1]+x)%MOD;
        hor=(x+hor)%MOD;
        vert[j]=(x+vert[j])%MOD;
      }
      else{
        diag[i-j+m-1]=0;
        hor=0;
        vert[j]=0;
      }
    }
  }

}

#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
using namespace std;
//using namespace atcoder;
using ll = long long;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;
typedef vector<vector<int> > Graph;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e18;

// auto mod int
// depends on Template

const int mod = 1000000007;
//const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

long long modpow(long long a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}



char s[2010][2010];
mint tate[2010][2010];
mint yoko[2010][2010];
mint naname[2010][2010];
mint dp[2010][2010];

int main(){
    ll h,w;
    cin >> h >> w;
    rep(i,h)rep(j,w)cin>>s[i+1][j+1];
    dp[1][1]=1;
    tate[1][1]=1;
    yoko[1][1]=1;
    naname[1][1]=1;
    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            if(i==1&&j==1)continue;
            if(s[i][j]=='#')continue;
            dp[i][j]+=tate[i-1][j];
            dp[i][j]+=yoko[i][j-1];
            dp[i][j]+=naname[i-1][j-1];
            tate[i][j]=dp[i][j]+tate[i-1][j];
            yoko[i][j]=dp[i][j]+yoko[i][j-1];
            naname[i][j]=dp[i][j]+naname[i-1][j-1];
        }
    }
    cout << dp[h][w]<<endl;
    return 0;
}
