#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define ep emplace
#define epb emplace_back
#define scll static_cast<long long> 
#define sz(x) static_cast<int>((x).size())
#define pfll(x) printf("%lld\n", x)
#define ci(x) cin >> x
#define ci2(x, y) cin >> x >> y
#define ci3(x, y, z) cin >> x >> y >> z
#define co(x) cout << x << endl
#define co2(x, y) cout << x << " " << y << endl
#define co3(x, y, z) cout << x << " " << y << " " << z << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef priority_queue<int> PQ;
typedef priority_queue<int, vector<int>, greater<int>> PQG;
typedef priority_queue<P> PQP;
typedef priority_queue<P, vector<P>, greater<P>> PQPG;

const int MAX_N = 2e5, MOD = 1e9 + 7, INF = 1e9;
int h, w;
char s[2000][2001];
int ans[2000][2000], sum[2000][2000][3];

int main() {
    ci2(h, w);
    rep(i, h) ci(s[i]);
    ans[0][0] = 1;
    rep(i, h) {
        rep(j, w) {
            if (s[i][j] == '#') continue;
            if (j > 0) {
                ans[i][j] = (ans[i][j] + sum[i][j - 1][0]) % MOD;
                sum[i][j][0] = sum[i][j - 1][0];
            }
            if (i > 0) {
                ans[i][j] = (ans[i][j] + sum[i - 1][j][1]) % MOD;
                sum[i][j][1] = sum[i - 1][j][1];
            }
            if (i > 0 && j > 0) {
                ans[i][j] = (ans[i][j] + sum[i - 1][j - 1][2]) % MOD;
                sum[i][j][2] = sum[i - 1][j - 1][2];
            }
            rep(k, 3) sum[i][j][k] = (sum[i][j][k] + ans[i][j]) % MOD;
        }
    }
    co(ans[h - 1][w - 1]);
    return 0;
}

#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <cmath>
#include <numeric>
#include <cfloat>
#include <iomanip>
using namespace std;
string S[2000];
long long dp[2000][2000];
long long dp_aux[2000][2000][3];
const long long MOD = 1000000007;
int main(){
  int H;
  int W;
  cin >> H >> W;

  for(int i = 0; i < H; i++){
    cin >> S[i];
  }

  dp[0][0] = 1;
  for(int i = 1; i < W; i++){
    if(S[0][i] != '#'){
      dp_aux[0][i][2] = (dp[0][i - 1] + dp_aux[0][i - 1][2]) % MOD;
      dp[0][i] = dp_aux[0][i][2];
    } else {
      break;
    }
  }

  for(int i = 1; i < H; i++){
    if(S[i][0] != '#'){
      dp_aux[i][0][0] = (dp[i - 1][0] + dp_aux[i - 1][0][0]) % MOD;
      dp[i][0] = dp_aux[i][0][0];
    }
    for(int j = 1; j < W; j++){
      if(S[i][j] != '#'){
        dp_aux[i][j][0] = (dp[i - 1][j] + dp_aux[i - 1][j][0]) % MOD;
        dp_aux[i][j][1] = (dp[i - 1][j - 1] + dp_aux[i - 1][j - 1][1]) % MOD;
        dp_aux[i][j][2] = (dp[i][j - 1] + dp_aux[i][j - 1][2]) % MOD;
        dp[i][j] = ((dp_aux[i][j][0] + dp_aux[i][j][1]) % MOD + dp_aux[i][j][2]) % MOD;
      }
    }
  }
  cout << dp[H - 1][W - 1] << endl;
  return 0;
}
