#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

template <u32 M>
struct modint {
    u32 val;
public:
    static modint raw(int v) { modint x; x.val = v; return x; }
    modint() : val(0) {}
    template <class T>
    modint(T v) { ll x = (ll)(v%(ll)(M)); if (x < 0) x += M; val = u32(x); }
    modint(bool v) { val = ((unsigned int)(v) % M); }
    modint& operator++() { val++; if (val == M) val = 0; return *this; }
    modint& operator--() { if (val == 0) val = M; val--; return *this; }
    modint operator++(int) { modint result = *this; ++*this; return result; }
    modint operator--(int) { modint result = *this; --*this; return result; }
    modint& operator+=(const modint& b) { val += b.val; if (val >= M) val -= M; return *this; }
    modint& operator-=(const modint& b) { val -= b.val; if (val >= M) val += M; return *this; }
    modint& operator*=(const modint& b) { u64 z = val; z *= b.val; val = (u32)(z % M); return *this; }
    modint& operator/=(const modint& b) { return *this = *this * b.inv(); }
    modint operator+() const { return *this; }
    modint operator-() const { return modint() - *this; }
    modint pow(long long n) const { modint x = *this, r = 1; while (n) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
    modint inv() const { return pow(M-2); }
    friend modint operator+(const modint& a, const modint& b) { return modint(a) += b; }
    friend modint operator-(const modint& a, const modint& b) { return modint(a) -= b; }
    friend modint operator*(const modint& a, const modint& b) { return modint(a) *= b; }
    friend modint operator/(const modint& a, const modint& b) { return modint(a) /= b; }
    friend bool operator==(const modint& a, const modint& b) { return a.val == b.val; }
    friend bool operator!=(const modint& a, const modint& b) { return a.val != b.val; }
};
using mint = modint<MOD>;

template <class T, class U>
vector<T> make_v(U size, const T& init){ return vector<T>(static_cast<size_t>(size), init); }

template<class... Ts, class U>
auto make_v(U size, Ts... rest) { return vector<decltype(make_v(rest...))>(static_cast<size_t>(size), make_v(rest...)); }

template<class T> void chmin(T &a, const T &b){ a = (a < b ? a : b); }
template<class T> void chmax(T &a, const T &b){ a = (a > b ? a : b); }

int main() {
    int h, w;
    cin >> h >> w;
    vector<string> v(h);
    for (auto &&i : v) {
        cin >> i;
    }
    auto dp1 = make_v(h+1, w+1, mint(0));
    auto dp2 = dp1, dp3 = dp1;
    dp1[1][1] = 1; dp2[1][1] = 1; dp3[1][1] = 1;
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            if(i == 0 && j == 0) continue;
            if(v[i][j] == '#') continue;
            mint val = dp1[i][j+1] + dp2[i+1][j] + dp3[i][j];
            dp1[i+1][j+1] = dp1[i][j+1] + val;
            dp2[i+1][j+1] = dp2[i+1][j] + val;
            dp3[i+1][j+1] = dp3[i][j] + val;
        }
    }
    cout << (dp1[h][w] - dp1[h-1][w]).val << "\n";
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
  
#define int long long 
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>

const int MOD = 1e9+7;
const int N = 2005;

int dp[N][N][4];
string s[N];
int n,m;

void solve()
{
   cin >> n >> m;
   f(i,n) cin >> s[i];
    
   f(i,n) f(j,m)
   {
       if(s[i][j] == '#') continue;
       
       if(i == 0 && j == 0) dp[i][j][0] = 1;
       if(i > 0) dp[i][j][0] += dp[i-1][j][1];
       if(j > 0) dp[i][j][0] += dp[i][j-1][2];
       if(i > 0 && j > 0) dp[i][j][0] += dp[i-1][j-1][3];
       
       dp[i][j][0]%=MOD;
       
       f(k,3) dp[i][j][k+1] = dp[i][j][0];
       
       if(i > 0 && j > 0) dp[i][j][3] = (dp[i][j][3] + dp[i-1][j-1][3])%MOD;
       if(i > 0) dp[i][j][1] = (dp[i][j][1] + dp[i-1][j][1])%MOD;
       if(j > 0) dp[i][j][2] = (dp[i][j][2] + dp[i][j-1][2])%MOD;
   }
    
   cout << dp[n-1][m-1][0]; 
}

signed main()
{
    fast;
    
    int t = 1;
    
//    cin >> t;
    
    while(t--)
        
    solve();
}