// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
#define ld long double
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
  

long long power(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a ;
        a = a * a ;
        b >>= 1;
    }
    return res;
}


const int mod=1e9+7;

int dp[2005][2005];
int pre1[2005][2005];
int pre2[2005][2005];
int pre3[2005][2005];

signed main()
{

ios_base::sync_with_stdio(false);
cin.tie(NULL);  
cout.tie(0);   

#ifndef ONLINE_JUDGE
    if(fopen("INPUT.txt","r"))
    {
    freopen ("INPUT.txt" , "r" , stdin);
    freopen ("OUTPUT.txt" , "w" , stdout);
    }
#endif          

    int n,m;
    cin>>n>>m;
    string a[n+1];
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        a[i]="#"+a[i];
    }
    dp[1][1]=1;
    pre1[1][1]=1;
    pre2[1][1]=1;
    pre3[1][1]=1;

    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            if(i==1 &&j==1)
                continue;
            if(a[i][j]=='#')
                continue;
            pre1[i][j]+=pre1[i-1][j];
            pre2[i][j]+=pre2[i][j-1];
            pre3[i][j]+=pre3[i-1][j-1];
            pre1[i][j]%=mod;
            pre2[i][j]%=mod;
            pre3[i][j]%=mod;
            dp[i][j]=(pre1[i][j]+pre2[i][j]+pre3[i][j])%mod;
            pre1[i][j]+=dp[i][j];
            pre2[i][j]+=dp[i][j];
            pre3[i][j]+=dp[i][j];
            pre1[i][j]%=mod;
            pre2[i][j]%=mod;
            pre3[i][j]%=mod;
        }
    }

    cout<<dp[n][m];

}       
#include<stdio.h>
#include<bits/stdc++.h>
#define ll long long int
#define inf 1000000000000
#define mod 1000000007
#define all(v) v.begin(),v.end()
#define fi first
#define se second
#define sz(x) (int)x.size()
#define ps(x,y)   fixed<<setprecision(y)<<x
using namespace std;
const int N = 2005;
ll dp[N][N], H[N][N], V[N][N], D[N][N];
char mat[N][N];
ll add(ll x, ll y)
{
    x += y;
    if (x >= mod)
        return x - mod;
    return x;
}

int check(int i, int j) {

    if (i < 1 || j < 1 || mat[i][j] != '#')return 0;
    return 1;
}

int h, w;

void solve()
{
    cin >> h >> w;
    memset(dp, 0, sizeof(dp));
    memset(H, 0, sizeof(H));
    memset(V, 0, sizeof(V));
    memset(D, 0, sizeof(D));
    for (int i = 1; i <= h; i++)
    {
        for (int j = 1; j <= w; j++)
        {
            cin >> mat[i][j];
        }
    }
    dp[1][1] = 1;
    H[1][1] = V[1][1] = D[1][1] = 1;
    for (int i = 1; i <= h; i++)
    {
        for (int j = 1; j <= w; j++)
        {
            if (i == 1 && j == 1) {
                continue;
            }
            if (mat[i][j] == '#') {
                continue;
            }
            dp[i][j] = add(H[i - 1][j], add(V[i][j - 1], D[i - 1][j - 1]));
            H[i][j] = V[i][j] = D[i][j] = dp[i][j];

            if (!check(i - 1, j))H[i][j] = add(H[i][j], H[i - 1][j]);
            if (!check(i, j - 1))V[i][j] = add(V[i][j], V[i][j - 1]);
            if (!check(i - 1, j - 1))D[i][j] = add(D[i][j], D[i - 1][j - 1]);
        }
    }
    cout << dp[h][w] << endl;
}
int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int t = 1;
    // scanf("%d", &t);
    while (t--) {
        solve();
    }

}