#include <bits/stdc++.h>
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
typedef long long ll;
typedef long double ld;
typedef complex<ld> point;
typedef vector<point> polygon;
#define X real()
#define Y imag()
#define angle(a) ( atan((a.imag()),a.real() )
#define dot(a, b) (conj(a) * (b)).real()
#define cross(a, b) (conj(a) * (b)).imag()
const double pi = acos(-1.0);
const double EPS=(1e-7);
typedef tuple <ld, ld, ld> line;

line lineeq(point x, point y)
{
    ll a = y.Y - x.Y;
    ll b = x.X - y.X;
    ll c = -a * x.X - b * x.Y;
    ll gcd = abs(__gcd(a, __gcd(b, c)));
    if(a < 0 || (a == 0 && b < 0))
        gcd *= -1;
    a /= gcd;
    b /= gcd;
    c /= gcd;
    return line(a, b, c);
}
point Getpoint(line l1, line l2)
{
    ld y = (get<0>(l1) * get<2>(l2) - get<0>(l2) * get<2>(l1)) / (get<0>(l2) * get<1>(l1) - get<0>(l1) * get<1>(l2));
    ld x = -1 * (get<1>(l1) * y + get<2>(l1)) / get<0>(l1);
    return point(x, y);
}

bool OnRay(point a, point b, point c)
{

    return dot(b - a, c - a) > EPS;
}

ld dist(point p, point q)
{
    return (p.X - q.X) * (p.X - q.X) + (p.Y - q.Y) * (p.Y - q.Y);
}
const ld angle = 90*pi/180;
point rotateArroundPoint(point p, point a)
{
    return (p - a) * polar((ld) 1, angle) + a;
}
/*
vector<ll>prime_fac;
void primeFactors(ll n)
{
    while (n%2 == 0)
    {
        prime_fac.push_back(2);
        n = n/2;
    }

    for (ll i = 3; i <= sqrt(n); i = i+2)
    {
        while (n%i == 0)
        {
            prime_fac.push_back(i);
            n = n/i;
        }
    }
    if (n > 2)
        prime_fac.push_back(n);
}
*/

ll m=1e9+7;
ll fast_power(ll x, ll y)
{
    if (y == 0)
        return 1;
    else if (y%2 == 0)
        return (fast_power(x, y/2)%m*fast_power(x, y/2))%m;
    else
        return (x%m*fast_power(x, y/2)%m*fast_power(x, y/2))%m;
}




/*
ll fac[(int)1e6];
ll mod=1e9+7;
void fact(ll n)
{
 fac[0]=1;
 for(ll i=1;i<n;i++)
        fac[i]=(fac[i-1]*i)%mod;
}
*/

/*
bool prime[1000005];
void SieveOfEratosthenes(ll n)
{

    memset(prime, true, sizeof(prime));

    for (ll p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (ll i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
}
*/



bool isPrime(ll n)
{
    if (n <= 1)
        return false;
    for (ll i = 2; i*i <= n; i++)
        if (n % i == 0)
            return false;

    return true;
}
vector<ll>v;
void printPrime(int n)
{
    for (int i = 2; i <= n; i++)
    {
        if (isPrime(i))
            v.push_back(i);
    }
}


/*
vector<ll>v;
void divesors(ll a)
{
    for(ll i=1;i*i<=a ;i++)
    {
        if(a%i==0)
        {

            if((a/i)==i)
            {

                v.push_back(i);
            }
            else
            {
                v.push_back(i);
                v.push_back(a/i);

            }
        }

    }
}
*/

/*
ld arr[10005][10005];
void Pascal(int n)
{




    for (int line = 0; line < n; line++)
    {

        for (int i = 0; i <= line; i++)
        {

        if (line == i || i == 0)
            arr[line][i] = 1;

        else
            arr[line][i] = arr[line - 1][i - 1] +
                            arr[line - 1][i];

        }

    }
}
*/


int h,w ,ans[1005][1005];
char grid[1005][1005];
int solve(int i , int j){
    if(i==h-1&&j==w-1)
        return 1;
    if(i>h-1 || j>w-1)
        return 0;
    if(grid[i][j]=='#')
    {
        //solve(i+1,j);
        //solve(i,j+1);
        return 0;
    }
    if(ans[i+1][j] !=-1 && ans[i][j+1]!=-1)
     {
         return ans[i][j]=(ans[i+1][j]+ans[i][j+1])%m;
     }
     if(ans[i+1][j]!=-1)
        return ans[i][j]=(ans[i+1][j]%m+solve(i,j+1)%m)%m;
     if(ans[i][j+1]!=-1)
        return ans[i][j]=(ans[i][j+1]%m+solve(i+1,j)%m)%m;
     return ans[i][j]=(solve(i+1,j)%m+solve(i,j+1)%m)%m;


}

int main()
{
    SPEED
    memset(ans,-1,sizeof ans);
    cin >> h >> w;
    for(ll i=0;i<h;i++)
        for(ll j=0;j<w;j++)
            cin >> grid[i][j];

    cout<<solve(0,0);

    return 0;
}


















/*string s;
    ll b;
    cin >> b;
    cin >> s ;
    if(b%2==1)
        return cout<<":(",0;

    for(ll i=0 ;i<s.size()/2;i++)
    {
        if(s[i]=='?')
            cout<<'(';
        else
            cout<<s[i];
    }
    for(ll i=s.size()/2; i<s.size();i++)
    {
        if(s[i]=='?')
            cout<<')';
        else
            cout<<s[i];
    }*/



Measured memory_bytes: 5248