#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
//#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rev(i,b,a) for (ll i = b - 1; i >= a; i--)
#define all(v) v.begin(), v.end()
#define maxe(v) *max_element(v.begin(), v.end())
#define mine(v) *min_element(v.begin(), v.end())
#define pb push_back
#define pf push_front
#define rem 1000000007
#define cont continue
//#define minn 999999999
//#define maxx 0
ll gcd(ll a, ll b);

ll gcd(ll a, ll b)
{
    if (a == 0)
        return b;
    return gcd(b%a, a);
}
ll modulo(ll a, ll b)
{
    ll r = a % b;
    return r < 0 ? r + b : r;
}
//ncr
ull ncr(ull n, ull r)
{
    if(r > n - r) r = n - r; // because C(n, r) == C(n, n - r)
    ull ans = 1;
    ull i;

    for(i = 1; i <= r; i++) {
        ans *= n - r + i;
        ans /= i;
    }

    return ans;
}
class abc
{
    public:
    ll val;
    ll ind;
};
bool fun1(abc x,abc y)
{
    return x.val>y.val;
}
///////////////////////////////////////////////////////
class abcd
{
    public:
    ll day;
    ll vas;
};
bool fun1(abcd x,abcd y)
{
    return x.vas<y.vas;
}
///////////////////////////////////////////
ll power(ll x, ll y, ll p)
{
    ll res = 1;      // Initialize result

    x = x % p;  // Update x if it is more than or
                // equal to p

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % p;

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}

// Returns n^(-1) mod p
ll modInverse(ll n, ll p)
{
    return power(n, p-2, p);
}
ll fact[100000+2];
ll ncrfast(ll n, ll r, ll p)
{
   if (r==0)
      return 1;
    return (fact[n]* modInverse(fact[r], p) % p *
            modInverse(fact[n-r], p) % p) % p;
}
///////////////////////////////////////////////////////
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    /*ll tc;
    cin>>tc;
    while(tc--)
    {}*/
    ll h,w;
    cin>>h>>w;
    char a[h][w];
    rep(i,0,h)
    {
        rep(j,0,w)
        cin>>a[i][j];
    }
    ll dp[h][w];
    ll flag=0;
    rep(i,0,h)
    {
        if( a[i][0]=='.' && flag==0  )
        {
            dp[i][0]=1;
        }
        else
        {
            dp[i][0]=0;
            flag=1;
        }
    }
    flag=0;
    rep(i,0,w)
    {
        if( a[0][i] == '.' && flag==0 )
        {
            dp[0][i]=1;
        }
        else
        {
            dp[0][i]=0;
            flag=1;
        }
    }
    rep(i,1,h)
    {
        rep(j,1,w)
        {
            if( a[i][j]=='.' )
            {
                dp[i][j]= ( dp[i-1][j]%rem  +   dp[i][j-1]%rem )%rem ;
                // ll cc1=0,cc2=0;
                // if( a[i-1][j]=='#' )
                // cc1=1;
                // if( a[i][j-2]=='#' )
                // cc2=1;
                // if( cc1==1 && cc2==1 )
                // {
                //     dp[i][j]=0;
                // }
                // else if( cc1==0 && cc2==1 )
                // {
                //     dp[i][j]=dp[i-1][j];
                // }
                // else if( cc1==1 && cc2==0 )
                // {
                //     dp[i][j]=dp[i][j-1];
                // }
                // else
                // {
                //     dp[i][j]=dp[i-1][j]+dp[i][j-1];
                // } 
            }
            else
            {
                dp[i][j]=0;
            } 
        }
    }
    cout<<dp[h-1][w-1];
}


Measured memory_bytes: 9088