#include<bits/stdc++.h>
#define ll long long int
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpii vector< pii >
#define vpll vector< pll >
#define mpii map<int,int>
#define mpll map<ll,ll>
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define s(v) v.size()
#define test ll t;cin>>t;while(t--)
#define vec vector<ll>
#define read0(v,n) for(int i=0;i<n;i++)cin>>v[i];
#define read1(v,n) for(int i=1;i<=n;i++)cin>>v[i];
#define trav(a,x) for (auto& a: x)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define cut(x) {cout<<x;return 0;}
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORB(i,a,b) for(int i=a;i>=b;i--)

#define mp make_pair
#define pb push_back
#define eb emplace_back
#define f first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define nl '\n'
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
#define oset tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
ll gcd(ll a, ll b)
{
	if (b==0)return a;
	return gcd(b, a % b);
}
ll lcm(ll a,ll b)
{
    return (a*b)/gcd(a,b);
}
ll pow(ll a, ll b)
{
	ll ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%MOD;
		b/=2;
		a=(a*a)%MOD;
	}
	return ans;
}

const int N=2005;
ll a[N][N],row[N][N],col[N][N],dia[N][N];
char g[N][N];
int main()
{
	fast
	ll n,m;
    cin>>n>>m;
    FOR(i,1,n)
    {
        string s;
        cin>>s;
        FOR(j,1,m)
        {
            g[i][j]=s[j-1];
        }
    }
    FOR(i,1,n)
    {
        FOR(j,1,m)
        {
            if(i==1 and j==1){a[i][j]=0;row[i][j]=1;col[i][j]=1;dia[i][j]=1;continue;}
            if(g[i][j]=='#')
            {
                row[i][j]=0;col[i][j]=0;row[i][j]=0;
                a[i][j]=0;
            }
            else
            {
                ll x=0,y=0,z=0;
                if(i-1>=1)x=col[i-1][j];
                if(i-1>=1 and j-1>=1)y=dia[i-1][j-1];
                if(j-1>=1)z=row[i][j-1];
                a[i][j]=x+y+z;
                row[i][j]=a[i][j]+(j-1>=1?row[i][j-1]:0);
                col[i][j]=a[i][j]+(i-1>=1?col[i-1][j]:0);
                dia[i][j]=a[i][j]+(j-1>=1 and i-1>=1?dia[i-1][j-1]:0);
                row[i][j]%=MOD;
                col[i][j]%=MOD;
                dia[i][j]%=MOD;
                a[i][j]%=MOD;
            }
        }
    }
    
   // FOR(i,1,n)FOR(j,1,m)cout<<dp[i][j]<<(j==m?nl:' ');
    cout<<a[n][m];


}

//g++ -std=gnu++14 a.cpp

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
#include <random>
#include <math.h>
#include <stdio.h>

using namespace std;

#define ll long long
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define P pair<ll,ll>
ll MOD = 1e9 + 7;
int INF = 1 << 30;
ll INFL = 1LL << 60;
ll MODP = 998244353;

ll lmax(ll x,ll y){
  if(x < y) return y;
  else return x;
}

ll lmin(ll x, ll y){
  if(x > y)return y;
  else return x;
}

void add(vector<string> &s,vector<vector<ll>> &v, ll a, ll b,vector<vector<ll>> &tate,vector<vector<ll>> &yoko,vector<vector<ll>> &naname){
  ll h = s.size(),w = s[0].size(),x = a, y = b;
  if(s[x-1][y-1] == '#')return;
  if(x+1 <= h){
    if(s[x+1-1][y-1] != '#'){
      v[x+1][y] += tate[x][y];
      tate[x+1][y] += 2*tate[x][y];
      yoko[x+1][y] += tate[x][y];
      naname[x+1][y] += tate[x][y];
      v[x+1][y] %= MOD;
      tate[x+1][y] %= MOD;
      yoko[x+1][y] %= MOD;
      naname[x+1][y] %= MOD;
    }
  }
  if(y+1 <= w){
    if(s[x-1][y+1-1] != '#'){
      v[x][y+1] += yoko[x][y];
      tate[x][y+1] += yoko[x][y];
      yoko[x][y+1] += 2*yoko[x][y];
      naname[x][y+1] += yoko[x][y];
      v[x][y+1] %= MOD;
      tate[x][y+1] %= MOD;
      yoko[x][y+1] %= MOD;
      naname[x][y+1] %= MOD;
    }
  }
  if(x+1 <= h && y+1 <= w){
    if(s[x+1-1][y+1-1] != '#'){
      v[x+1][y+1] += naname[x][y];
      tate[x+1][y+1] += naname[x][y];
      yoko[x+1][y+1] += naname[x][y];
      naname[x+1][y+1] += 2*naname[x][y];
      v[x+1][y+1] %= MOD;
      tate[x+1][y+1] %= MOD;
      yoko[x+1][y+1] %= MOD;
      naname[x+1][y+1] %= MOD;
    }
  }
}

int main(){
  ll H,W;
  cin >> H >> W;
  vector<string> S(H);
  rep(i,H) cin >> S[i];
  vector<vector<ll>> ans(H+1,vector<ll>(W+1,0));
  vector<vector<ll>> tate(H+1,vector<ll>(W+1,0)),yoko(H+1,vector<ll>(W+1,0)),naname(H+1,vector<ll>(W+1,0));
  ans[1][1] = 1,yoko[1][1] = 1,tate[1][1] = 1,naname[1][1] = 1;
  for(int i = 1;i <= H;i++){
    ll s = i,t = 1;
    while(s > 0 && t <= W){
      add(S,ans,s,t,tate,yoko,naname);
      s--;
      t++;
    }
  }
  for(int i = 2;i <= W;i++){
    ll s = H, t = i;
    while(s > 0 && t <= W){
      add(S,ans,s,t,tate,yoko,naname);
      s--;
      t++;
    }
  }

  cout << ans[H][W] << endl;
 

  return 0;
}
