#include <bits/stdc++.h>
using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;

#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define test() int t;cin>>t;for(int test=1;test<=t;test++)
#define pb push_back
#define nl cout<<"\n"
#define all(x) x.begin(),x.end()

template<class C> void min_self( C &a, C b ){ a = min(a,b); }
template<class C> void max_self( C &a, C b ){ a = max(a,b); }

const ll MOD = 1000000007;
ll mod( ll n, ll m=MOD ){ n%=m,n+=m,n%=m;return n; }

const int MAXN = 1e5+5;
const int LOGN = 21;
const ll INF = 1e14;
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};

template<class T1, class T2> void add( T1 &x, T2 y, ll m = MOD )
{
    x += y;
    if( x >= m )
        x -= m;
}

template<class T1, class T2> void sub( T1 &x, T2 y, ll m = MOD )
{
    x -= y;
    if( x < 0 )
        x += m;
}

char grid[2002][2002];
int up[2002][2002], lft[2002][2002], diag[2002][2002];
ll dp[2002][2002], prefix_row[2002][2002], prefix_col[2002][2002], prefix_diag[4004][2002];

int main() 
{
    #ifdef gupta_samarth
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    fastio();

    int h,w;
    cin>>h>>w;
    for(int i=0;i<h;i++)
    {
        for(int j=0;j<w;j++)
        {
            cin>>grid[i][j];
            if( grid[i][j] == '#' )
            {
                lft[i][j] = j;
                up[i][j] = i;
                diag[i][j] = i;
            }
            else
            {
                lft[i][j] = ( j-1 >= 0 ? lft[i][j-1] : 0 );
                up[i][j] = ( i-1 >= 0 ? up[i-1][j] : 0 );
                diag[i][j] = ( i-1 >= 0 && j-1 >= 0 ? diag[i-1][j-1] : 0 );
            }
            dp[i][j] = 0;
        }
    }

    auto sum_row = [&]( int row, int lc, int rc ) -> ll
    {
        if( rc < lc )
            return 0;
        ll ans = prefix_row[row][rc];
        if( lc )
            sub( ans, prefix_row[row][lc] );
        return ans;
    };

    auto sum_col = [&]( int col, int lr, int rr ) -> ll
    {
        if( rr < lr )
            return 0;
        ll ans = prefix_col[rr][col];
        if( lr )
            sub( ans, prefix_row[lr][col] );
        return ans;
    };

    auto sum_diag = [&]( int dg, int l, int r ) -> ll
    {
        if( r < l )
            return 0;
        ll ans = prefix_diag[dg][r];
        if( l )
            sub( ans, prefix_diag[dg][l] );
        return ans;
    };

    auto update = [&]( int i, int j, ll val )
    {
        if( j-1 >= 0 )
            prefix_row[i][j] = prefix_row[i][j-1];
        add( prefix_row[i][j], val );

        if( i-1 >= 0 )
            prefix_col[i][j] = prefix_col[i-1][j];
        add( prefix_col[i][j], val );

        if( i-1 >= 0 )
            prefix_diag[j-i+2000][i] = prefix_diag[j-i+2000][i-1];
        add( prefix_diag[j-i+2000][i], val );
    };

    dp[0][0] = 1;
    update(0,0,1);
    for(int i=0;i<h;i++)
    {
        for(int j=0;j<w;j++)
        {
            if( grid[i][j] == '#' || ( i == 0 && j == 0 ) )
                continue;

            // cout<<"NOW: "<<i<<" "<<j,nl;
            // cout<<"Left: "<<i<<" "<<lft[i][j],nl;
            // cout<<"Up: "<<up[i][j]<<" "<<j,nl;

            // for(int a=0;a<=j;a++)
            //     cout<<prefix_row[i][a]<<" ";
            // nl;nl;

            ll now = 0;
            add( now, sum_row(i,lft[i][j],j-1) );
            add( now, sum_col(j,up[i][j],i-1) );
            add( now, sum_diag(j-i+2000,diag[i][j],i-1));
            add( dp[i][j], now );
            update(i,j,dp[i][j]);

        }
    }
    cout<<dp[h-1][w-1],nl;


    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
}

#include<bits/stdc++.h>
#define _USE_MATH_DEFINES
using namespace std;
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
    
#define ll long long int
#define ld double
#define pb push_back
#define rep(i , j , n) for(ll i = j ; i < n ; i++)
#define pre(i , j , n) for(ll i = j ; i >= n ; i--)
#define all(x) x.begin(), x.end()
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vll;
typedef vector<char>	vc;
typedef vector<bool>	vb;
typedef pair<ll,ll> 	pll;
#define br "\n"
#define ff first
#define ss second
#define gcd __gcd
ll mod = 1e9 + 7;

ll dirx[] = {-1,-1,0};
ll diry[] = {-1,0,-1};
ll sum[2000][2000][3];
ll dp[2000][2000];
vector<vll> grid;

void solve(){
    ll n,m;
    cin >> n >> m;
    grid.assign(n,vll(m));
    rep(i,0,n){
        rep(j,0,m){
            char c;
            cin >> c;
            if(c == '.') grid[i][j] = 1; 
            rep(k,0,3){
                sum[i][j][k] = 0;
            }
            dp[i][j] = 0;
        }
    }
    dp[0][0] = 1;
    rep(i,0,n){
        rep(j,0,m){
            rep(k,0,3){
                if(!grid[i][j]){
                    continue;
                }
                ll x = i + dirx[k], y = j + diry[k];
                if(x < 0 || y < 0 || x >= n || y >= m) continue;
                (dp[i][j] += sum[x][y][k]) %= mod; 
                (sum[i][j][k] += sum[x][y][k]) %= mod;
            }
            rep(k,0,3){
                (sum[i][j][k] += dp[i][j]) %= mod;
            }
        }
    }
    cout << dp[n - 1][m - 1];
    

}
 
 
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif 
 
	ll t = 1;
    // cin >> t;
	rep(i,0,t){
        // cout << "Case #" << i + 1 << ": ";
        solve();
        // test();
	}
 
}