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

int64_t mod = 1000000007;

int main(){
  int H, W;
  cin >> H >> W;
  vector<string> v(H);
  for(int i = 0;i < H;i++)
    cin >> v.at(i);
  vector<int64_t> H_sum(H, 0);
  vector<int64_t> W_sum(W, 0);
  vector<int64_t> D_sum(H + W, 0);
  int64_t dp[H][W];
  for(int i = 0;i < H;i++){
    for(int j = 0;j < W;j++){
      if(i == 0 && j == 0){
        dp[0][0] = 1;
        H_sum.at(0) = 1;
        W_sum.at(0) = 1;
        D_sum.at(W - 1) = 1;
      }
      else{
        if(v.at(i).at(j) == '.'){
          dp[i][j] = (H_sum.at(i) + W_sum.at(j) + D_sum.at(i - j + W - 1)) % mod;
          H_sum.at(i) += dp[i][j];
          W_sum.at(j) += dp[i][j];
          D_sum.at(i - j + W - 1) += dp[i][j];
        }
        else{
          H_sum.at(i) = 0;
          W_sum.at(j) = 0;
          D_sum.at(i - j + W - 1) = 0;
        }
      }
    }
  }
  cout << (dp[H - 1][W - 1]) % mod << endl;
}
#include <bits/stdc++.h>

using namespace std;

#define all(x) x.begin(), x.end()
#define sz(x) (int) x.size()
#define pb push_back
#define endl '\n'
#define snd second
#define fst first
#define fastio cin.tie(NULL),cout.sync_with_stdio(true)

//typedef long long int ll;
typedef unsigned long long int ull;
typedef vector <int> vi;
typedef pair <int, int> ii;

const int mod = 1e9 + 7;
//const ll INF = 1e18;
const double EPSILON = 1e-10;
const int N = 2005;
char t[N][N];
int l[N][N], c[N][N], d[2][N][N];
vi ll[N], cc[N], dd[2][N];
int add(int a, int b){
    a += b;
    if(a >= mod)
        a -= mod;
    return a;
}
int sub(int a, int b){
    a -= b;
    if(a < 0)
        a += mod;
    return a;
}
int main(){
    fastio;
    int n,m;
    cin >> n >> m;
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= m; j++)
            cin >> t[i][j];
    for(int i = 0; i < N; i++)
        ll[i].pb(0), cc[i].pb(0), dd[0][i].pb(0), dd[1][i].pb(0);
    if(n == 1 and m == 1){
        cout << 1 << '\n';
        return 0;
    }
    l[1][1] = c[1][1] = d[0][0][1] = 1;
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= m; j++){
            if(i == 1 and j == 1)continue;
            if(t[i][j] == '#'){
                ll[i].pb(i);
                cc[j].pb(j);
                if(i-j >= 0){
                    dd[0][i-j].pb(i);
                }else{
                    dd[1][j-i].pb(i);
                }
            }else{
                int tmp = 0;
                tmp = add(tmp, sub(l[i-1][j], (ll[i][sz(ll[i])-1] > 0 ? l[ ll[i][sz(ll[i])-1] ][j] : 0)));
                tmp = add(tmp, sub(c[i][j-1], (cc[j][sz(cc[j])-1] > 0 ? c[i][ cc[j][sz(cc[j])-1] ] : 0)));

                if(i-j>=0){
                    tmp = add(tmp, sub(d[0][i-j][i-1], (dd[0][i-j][sz(dd[0][i-j])-1] > 0 ? d[0][i-j][ dd[0][i-j][sz(dd[0][i-j])-1] ] : 0)));
                }else{
                    tmp = add(tmp, sub(d[1][j-i][i-1], (dd[1][j-i][sz(dd[1][j-i])-1] > 0 ? d[1][j-i][ dd[1][j-i][sz(dd[1][j-i])-1] ] : 0)));
                }
                if(i == n and j == m){
                    cout << tmp << '\n';
                }
                l[i][j] = add(l[i-1][j], tmp);
                c[i][j] = add(c[i][j-1], tmp);
                if(i-j >= 0){
                    d[0][i-j][i] = add(d[0][i-j][i-1], tmp);
                }else{
                    d[1][j-i][i] = add(d[1][j-i][i-1], tmp);
                }
            }
        }
    }
    return 0;
}
