//--------PREPROCESSOR--------PREPROCESSOR--------PREPROCESSOR--------PREPROCESSOR--------PREPROCESSOR--------PREPROCESSOR--------PREPROCESSOR
//--------PREPROCESSOR--------PREPROCESSOR--------PREPROCESSOR--------PREPROCESSOR--------PREPROCESSOR--------PREPROCESSOR--------PREPROCESSOR

// Important header files
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
#include <functional> // for less
#include <iostream>
using namespace __gnu_pbds;
using namespace std;



#include <iostream>
#include<bits/stdc++.h>
using namespace std;
using namespace std::chrono;
#define REDL(a ,n) vll a(n);for(ll i=0;i<n;i++) cin>>a[i];
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(X)  X.begin() ,  X.end()
#define reset(X) memset(X, 0, sizeof(X))
#define f(a,b,c) for(ll a=b;a<c;a++)
//-----------------------------TEMPLATES------------------TEMPLATES---------------------------TEMPLATES---------------------------------
//-----------------------------TEMPLATES------------------TEMPLATES---------------------------TEMPLATES---------------------------------



//--------------TYPEDEF--------------TYPEDEF--------------TYPEDEF--------------TYPEDEF--------------TYPEDEF--------------TYPEDEF--------------TYPEDEF----------------------------TYPEDEF
//--------------TYPEDEF--------------TYPEDEF--------------TYPEDEF--------------TYPEDEF--------------TYPEDEF--------------TYPEDEF--------------TYPEDEF----------------------------TYPEDEF

typedef  long long ll;
typedef complex<long double> cd;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<ll,ll> pii;
typedef vector<ll> vll;
// Declaring ordered_set
typedef tree<ll, null_type, less<ll>, rb_tree_tag,
        tree_order_statistics_node_update>
        ordered_set;

//--------------CONSTANTS--------------CONSTANTS--------------CONSTANTS--------------CONSTANTS--------------CONSTANTS--------------CONSTANTS--------------CONSTANTS
//--------------CONSTANTS--------------CONSTANTS--------------CONSTANTS--------------CONSTANTS--------------CONSTANTS--------------CONSTANTS--------------CONSTANTS

const ll INF=LLONG_MAX-100;
const ll mod=1000000007;
//const ll mod=998244353;





//------------------IGNOREABLE_CONTENT------------------IGNOREABLE_CONTENT------------------IGNOREABLE_CONTENT------------------IGNOREABLE_CONTENT



// To find GCD of a and b

// To compute x raised to power y under modulo m
ll power(ll x, ll y, ll m);

// Function to find modular inverse of a under modulo m
// Assumption: m is prime
ll modInverse(ll a, ll m)
{
    ll g = __gcd(a, m);
    if (g != 1)
        cout << "Inverse doesn't exist";
    else
    {
        // If a and m are relatively prime, then modulo inverse
        // is a^(m-2) mode m
        return power(a, m-2, m);
    }
}

// To compute x^y under modulo m


//code to  look for-----------------------------------------------------------------
/*
const ll MAXN=1e6+100;
ll  prime[MAXN];
bool is_composite[MAXN];
ll phi[MAXN];

void sieve (ll n) {
	phi[1] = 1;
	ll primes_count=0;
	for (ll i = 2; i < n; ++i) {
		if (!is_composite[i]) {
			prime[primes_count]=i;
			primes_count++;
			phi[i] = i - 1;					//i is prime
		}
		for (ll j = 0; j < primes_count && i * prime[j] < n; ++j) {
			is_composite[i * prime[j]] = true;
			if (i % prime[j] == 0) {
				phi[i * prime[j]] = phi[i] * prime[j];	//prime[j] divides i
				break;
			} else {
				phi[i * prime[j]] = phi[i] * phi[prime[j]];	//prime[j] does not divide i
			}
		}
	}
}*/



void fft(vector<cd>&  a, bool invert)
{
    ll n=a.size();
    ld PI=acos(-1);
    for(ll i=1,j=0; i<n; i++)
    {
        ll bit=n>>1;
        for(; j&bit; bit>>=1)
        {
            j^=bit;
        }
        j^=bit;
        if(i<j)
            swap(a[i], a[j]);
    }
    for(ll i=2; i<=n; i<<=1)
    {
        double ang=2*PI/i*(invert?-1:1);
        cd wn(cos(ang), sin(ang));
        for(ll j=0; j<n; j+=i)
        {
            cd w(1);
            for(ll k=j; k<j+i/2; k++)
            {
                cd u=a[k], v=a[k+i/2]*w;
                a[k]=u+v;
                a[k+i/2]=u-v;
                w*=wn;
            }
        }

    }
    if(invert)
    {
        for(ll i=0; i<n; i++)
            a[i]/=n;
    }

}
vector<ll>  multfft(vector<ll> a, vector<ll>b)
{
    vector<cd> fa(all(a)), fb(all(b));
    ll n=1;
    while(fa.size()+fb.size()>n)
        n*=2;
    fa.resize(n);
    fb.resize(n);
    vector<ll> result(n);
    fft(fa,false);
    fft(fb,false);
    for(ll i=0; i<n; i++)
        fa[i]*=fb[i];
    fft(fa,true);
    for(ll i=0; i<n; i++)
        result[i]=round(fa[i].real());
    return result;

}
bool isPrime(ll n)
{
    // Corner case
    if (n <= 1)
        return false;

    // Check from 2 to n-1
    for (ll i=2; i<n; i++)
        if (n%i == 0)
            return false;

    return true;
}

//----------------------MAIN______________________________MAIN__________________MAIN

struct compare
{
    bool operator() (const pll& lhs, const pll& rhs) const
    {
        if(lhs.fi<rhs.se)
            return true;
        if(lhs.fi>rhs.se)
            return false;
        return lhs.se>rhs.se;
    }
};
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;
}
vll mult(vll freq, vll freq2,ll n )
{
    ll k=accumulate(all(freq), 0);
    if(k==0)
        return freq2;
    vll temp(n);
    for(ll i=0; i<n; i++)
    {
        for(ll j=0; j<n; j++)
        {
            temp[(i*j)%n]=(temp[(i*j)%n]+(freq[i]*freq2[j])%mod)%mod;
        }
    }
    return temp;
}
string common(string a, string b)
{
    ll k=min(a.size(), b.size());

}
signed main()
{


    auto start = high_resolution_clock::now();

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    cout.tie(0);
    //----------------  --------------------------------------------------------------------------------
 int h, w;
 cin>>h>>w;
 int arr[h][w];
 for(int i=0;i<h;i++)
 {
    for(int j=0;j<w;j++)
    {
        char ch;
        cin>>ch;
        arr[i][j]=(ch=='.');
    }
 }
 ll dp[h][w];
 reset(dp);
 dp[0][0]=1;
    for(int i=0;i<h;i++)
    {
        for(int j=0;j<w;j++)
        {

                if(i!=0)
                    dp[i][j]=(arr[i-1][j]*dp[i-1][j])%mod;
                if(j!=0)
                    dp[i][j]=(dp[i][j]+arr[i][j-1]*dp[i][j-1])%mod;


        }
    }
    cout<<dp[h-1][w-1];
    //-----------00;--------------------------
    //-----------------------------------------------------------


    auto stop = high_resolution_clock::now();
    auto duration = duration_cast<microseconds>(stop - start);

    cerr <<endl<<"Time in microseconds:" <<duration.count() <<endl<<"Time in seconds:"<<duration.count()/(1000000.0)<< endl;
}


Measured memory_bytes: 12032