/*#include <bits/stdc++.h>
#define cross(a,b) (conj(a)*(b)).imag()
#define dot(a,b) (conj(a)*(b)).real()
#define ld long double
#define ll long long
#define vec(a,b) (b-a)
#define pi acos(-1)
//#define x real()
//#define y imag()


using namespace std;
typedef complex <ld> point;
typedef vector<point> polygon;
typedef tuple<int,int,int> line; // represents a b c of line

vector <ll> v;
//vector <ll> vc;

//ll mod = 1e9 +7;
//ll fact[1000005], inv[1000005];
//int p;


bool prime(ll n)
{
   if(n==1)
    return false;
   for(int i=2; i<=sqrt(n); ++i)
   {
       if(n%i==0)
       {
           return false;
       }
   }
   return true;
}

/*unsigned long long fp(ll x, ll y)
{
    if(y==0)
    {
        return 1;
    }
    ll z = fp(x,(y/2));

    if(y%2==0)
    {
        return (z*z)%p;
    }
    else
        return (((z*z)%p)*(x%p))%p;
}*/
/*unsigned long long fp(ll x, ll y)
{
    if(y==0)
    {
        return 1;
    }
    ll z = fp(x,(y/2));

    if(y%2==0)
    {
        return (z*z)%mod;
    }
    else
        return (((z*z)%mod)*(x%mod))%mod;
}
void pre()
{
  fact[0]=inv[0]=1;
  for(int i=1; i<=1000005; ++i)
  {
      fact[i]=(fact[i-1]*i)%mod;
      inv[i]=fp(fact[i], mod-2);
  }
}
unsigned ll ncr(int n, int r)
{
    return (((fact[n]*inv[n-r])%mod) * inv[r])%mod;
}*/

/*int main()
{
    //pre();
    int n, ans=0;
    ll c;
    cin >> n;
    for(int k=1; k<=n; ++k)
    {
        c=0;
        bool arr[30005]={false};
        if(prime(k))
            continue;
        for(ll i=1; i*i<=k; ++i)
        {
            if(k%i==0 && prime(i) && arr[i]==false)
            {
                c++;
                arr[i]=true;
            }
            if(k%i==0 && prime(k/i) && arr[k/i]==false)
            {
                    c++;
                    arr[k/i]=true;
            }
        }
        if(c==2)
            ans++;
    }
    cout << ans << endl;*/
/*cin >>p;
int cnt=0;
bool ch=1;
for(int i=1; i<p; ++i)
{
    ch=1;
    for(int j=1; j<=p-2; ++j)
    {
            if(((fp(i,j)-1)+p)%p==0)
            {
                ch=0;
            }
            if( ((fp(i,p-1)-1)+p)%p!=0)
            {
                ch=0;
            }
            if(!ch)
            {
                break;
            }
    }
    if(ch)
        cnt++;
}
cout << cnt << endl;*/
//return 0;
//}

#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;
int h, w, a[1005][1005], ans[1005][1005];
char arr[1005][1005];
ll solve(int x, int y)
{
    if(x>h || y>w || arr[x][y]=='#') //my5rogsh bara el grid
        return 0;
    if(a[x][y]!=-1)
        return a[x][y];
    if(x==h && y==w)
        return 1;
     int ans;
     ans=((solve(x,y+1)%mod)+(solve(x+1,y)%mod))%mod;
     a[x][y]=ans;
     return ans;

}
//ll ans[N];
//int arr[N][3];
// vector< vector<ll> > v(N);
int main()
{
    /*ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);*/
    cin >> h >> w;
    for(int i=1; i<=h; ++i)
    {
        for(int j=1; j<=w; ++j)
        {
          cin >> arr[i][j];
        }
    }
    memset(a, -1, sizeof a);
    cout << solve(1,1);
    /*int sum, n;
    cin >> sum >> n;
    int arr[n];
    for(int i=0; i<n; ++i)
    {
        cin >> arr[i];
    }
    for(int i=0; i<n; ++i)
    {
        ans[i][0]=1;
    }
    for(int i=0; i<n; ++i)
    {
        for(int j=1; j<=sum; ++j)
        {
            if(i)
            {
                ans[i][j]=ans[i-1][j];
            }
            if(j-arr[i]>=0)
            {
                ans[i][j]+=ans[i][j-arr[i]];
            }
        }
    }
    cout << ans[n-1][sum];*/
    return 0;
}





Measured memory_bytes: 6144