#include <bits/stdc++.h>
using namespace std;
template <class t>
inline t read(t &x) {
  char c = getchar();
  bool f = 0;
  x = 0;
  while (!isdigit(c)) f |= c == '-', c = getchar();
  while (isdigit(c)) x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
  if (f) x = -x;
  return x;
}
template <class t>
inline void write(t x) {
  if (x < 0)
    putchar('-'), write(-x);
  else {
    if (x > 9) write(x / 10);
    putchar('0' + x % 10);
  }
}
template <class t>
inline void writeln(t x) {
  write(x);
  putchar('\n');
  return;
}
template <class t>
inline void write_blank(t x) {
  write(x);
  putchar(' ');
  return;
}
int n, m;
char nl[2020][2020];
int h[2020][2020], l[2020][2020];
int H[2020][2020], L[2020][2020];
int dp[2][2020][2020];
const long long mod = 1e9 + 7;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> nl[i] + 1;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = m; j >= 1; j--) {
      h[i][j] = h[i][j + 1] + (nl[i][j] == '.');
    }
  }
  for (int i = n; i >= 1; i--) {
    for (int j = 1; j <= m; j++) {
      l[i][j] = l[i + 1][j] + (nl[i][j] == '.');
    }
  }
  dp[0][1][1] = dp[1][1][1] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      H[i][j] = (H[i][j] + H[i][j - 1]) % mod;
      L[i][j] = (L[i][j] + L[i - 1][j]) % mod;
      if (i != 1 || j != 1) {
        dp[1][i][j] = H[i][j];
        dp[0][i][j] = L[i][j];
      }
      H[i][j + 1] = (H[i][j + 1] + dp[0][i][j]) % mod;
      H[i][j + h[i][j + 1] + 1] =
          (H[i][j + h[i][j + 1] + 1] - dp[0][i][j]) % mod;
      L[i + 1][j] = (L[i + 1][j] + dp[1][i][j]) % mod;
      L[i + l[i + 1][j] + 1][j] =
          (L[i + l[i + 1][j] + 1][j] - dp[1][i][j]) % mod;
    }
  }
  if (n == 1 && m == 1) {
    cout << 1 << endl;
    return 0;
  }
  int ans = (dp[0][n][m] + dp[1][n][m]) % mod;
  cout << (ans + mod) % mod << endl;
  return 0;
}
