#include<bits/stdc++.h>
using namespace std;
const long long mod=1e9+7;
int a[2001][2001];
long long dp[2001][2001];
long long h[2001],l[2001],hjl[4001];
int main()
{
	int n,m;scanf("%d%d",&n,&m);getchar();
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
			a[i][j]=getchar();
		getchar();
	}
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			if(a[i][j]=='#')h[i]=0,l[j]=0,hjl[i-j+2000]=0;
			else
			{
				if(i==1&&j==1)dp[i][j]=1;else
				dp[i][j]=(h[i]+l[j]+hjl[i-j+2000])%mod;
				h[i]=(dp[i][j]+h[i])%mod;
				l[j]=(dp[i][j]+l[j])%mod;
				hjl[i-j+2000]=(dp[i][j]+hjl[i-j+2000])%mod;
			}
	cout<<dp[n][m];
	return 0;
}
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<iostream>
#include<cstdint>
#include<cstddef>
#include<vector>
//#include<atcoder/all>
//using namespace atcoder;
using namespace std;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using usize = uint_fast64_t;
template<typename T>
using vec = vector<T>;
#define rep(i, n) for (i64 i = 0; i < (i64)(n); ++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using P = pair<i64,i64>;
void solve(){
}
using i64 = int_fast64_t;
constexpr i64 MAX = 10000000;
constexpr i64 MOD = 1000000007;
i64 fac[MAX], finv[MAX], inv[MAX];
template <i64 modulus>
class modcal
{

public:
  i64 a;

  constexpr modcal(const i64 x = 0) noexcept : a(x % modulus) {}
  constexpr i64 &value() noexcept { return a; }
  constexpr const i64 &value() const noexcept { return a; }
  constexpr modcal operator+(const modcal rhs) const noexcept
  {
    return modcal(*this) += rhs;
  }
  constexpr modcal operator-(const modcal rhs) const noexcept
  {
    return modcal(*this) -= rhs;
  }
  constexpr modcal operator*(const modcal rhs) const noexcept
  {
    return modcal(*this) *= rhs;
  }
  constexpr modcal operator/(const modcal rhs) noexcept
  {
    return modcal(*this) /= rhs;
  }
  constexpr modcal &operator+=(const modcal rhs) noexcept
  {
    a += rhs.a;
    if (a >= modulus)
    {
      a -= modulus;
    }
    return *this;
  }
  constexpr modcal &operator-=(const modcal rhs) noexcept
  {
    if (a < rhs.a)
    {
      a += modulus;
    }
    a -= rhs.a;
    return *this;
  }
  constexpr modcal &operator*=(const modcal rhs) noexcept
  {
    a = a * rhs.a % modulus;
    return *this;
  }
  constexpr modcal &operator/=(modcal rhs) noexcept
  {
    i64 exp = modulus - 2;
    while (exp)
    {
      if (exp % 2)
      {
        *this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }

  void COMninit()
  {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++)
    {
      fac[i] = fac[i - 1] * i % modulus;
      inv[i] = MOD - inv[modulus % i] * (modulus / i) % modulus;
      finv[i] = finv[i - 1] * inv[i] % modulus;
    }
  }
  i64 COMn(i64 n, i64 k)
  {
    if (n < k)
      return 0;
    if (n < 0 || k < 0)
      return 0;
    return fac[n] * (finv[k] * finv[n - k] % modulus) % modulus;
  }
  constexpr modcal<1000000007> modpow(const modcal<1000000007> &a, i64 n)
  {
    if (n == 0)
      return 1;
    auto t = modpow(a, n / 2);
    t = t * t;
    if (n & 1)
      t = t * a;
    return t;
  }
};
using modc = modcal<1000000007>;
int main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    i64 h,w;
    cin >> h >> w;
    vec<string> s(h);
    rep(i,h)cin >> s[i];
    i64 dx[3] = {1,1,0};
    i64 dy[3] = {0,1,1};
    vec<vec<vec<modc>>> dp(h,vec<vec<modc>>(w,vec<modc>(4,0)));
    dp[0][0][3] = 1;
    rep(i,h){
        rep(j,w){
            rep(k,4){
                if(dp[i][j][k].a == 0)continue;
                rep(v,3){
                    i64 ny = dy[v] + i;
                    i64 nx = dx[v] + j;
                    if(nx < 0 || nx >= w || ny < 0 || ny >= h)continue;
                    if(s[ny][nx] == '#')continue;
                    dp[ny][nx][v] += dp[i][j][k];
                    if(k == v)dp[ny][nx][v] += dp[i][j][k];
                }
            }
        }
    }
    modc ans = 0;
    rep(i,3){
        ans += dp[h - 1][w - 1][i];
    }
    cout << ans.a << endl;
}