#include <bits/stdc++.h>
using namespace std;
void run();
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  run();
  return 0;
}
const long long MAXN = 2e3 + 1, mod = 1e9 + 7;
bool field[MAXN][MAXN];
long long dp_right[MAXN][MAXN], dp_down[MAXN][MAXN], rock_right[MAXN][MAXN],
    rock_down[MAXN][MAXN];
inline void run() {
  long long n, m;
  cin >> n >> m;
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < m; j++) {
      char c;
      cin >> c;
      field[i][j] = c == '.';
    }
  }
  if (n == 1 && m == 1) {
    cout << field[0][0];
    return;
  }
  for (long long i = n - 1; i >= 0; i--) {
    for (long long j = m - 1; j >= 0; j--) {
      if (i != n - 1) {
        rock_down[i][j] += rock_down[i + 1][j];
        rock_down[i][j] += !field[i + 1][j];
      }
      if (j != m - 1) {
        rock_right[i][j] += rock_right[i][j + 1];
        rock_right[i][j] += !field[i][j + 1];
      }
    }
  }
  dp_down[n - 1][m - 1] = dp_right[n - 1][m - 1] = 1;
  for (long long i = n - 1; i >= 0; i--) {
    for (long long j = m - 1; j >= 0; j--) {
      if (i != n - 1) {
        dp_down[i][j] = dp_down[i + 1][j];
        dp_down[i][j] += dp_right[i + 1][j];
        if (!field[i + 1][j]) {
          assert(n - 1 - rock_down[i + 1][j] >= 0 &&
                 n - 1 - rock_down[i + 1][j] < n);
          dp_down[i][j] -= dp_right[n - 1 - rock_down[i + 1][j]][j];
        }
      }
      if (j != m - 1) {
        dp_right[i][j] = dp_right[i][j + 1];
        dp_right[i][j] += dp_down[i][j + 1];
        if (!field[i][j + 1]) {
          assert(m - 1 - rock_right[i][j + 1] >= 0 &&
                 m - 1 - rock_right[i][j + 1] < m);
          dp_right[i][j] -= dp_down[i][m - 1 - rock_right[i][j + 1]];
        }
      }
      if (i == n - 1) dp_right[i][j] = rock_right[i][j] == 0 ? 1 : 0;
      if (j == m - 1) dp_down[i][j] = rock_down[i][j] == 0 ? 1 : 0;
      dp_right[i][j] %= mod;
      dp_down[i][j] %= mod;
    }
  }
  auto ans = dp_right[0][0] + dp_down[0][0];
  while (ans < 0) ans += mod;
  cout << ans % mod;
}
