#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool scan(T &ret) {
  char c;
  int sgn;
  if (c = getchar(), c == EOF) return 0;
  while (c != '-' && (c < '0' || c > '9')) c = getchar();
  sgn = (c == '-') ? -1 : 1;
  ret = (c == '-') ? 0 : (c - '0');
  while (c = getchar(), c >= '0' && c <= '9') ret = ret * 10 + (c - '0');
  ret *= sgn;
  return 1;
}
const long long mod = 1e9 + 7;
const int maxn = 2005;
long long qp(long long x, long long n) {
  long long res = 1;
  x %= mod;
  while (n > 0) {
    if (n & 1) res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}
char mp[maxn][maxn];
long long dp[maxn][maxn][2];
long long pre[maxn][maxn][2];
long long has[maxn][maxn][2];
int n, m;
inline void add(int &a, int b) { a = (a + b) % mod; }
inline void del(int &a, int b) { a = (a - b + mod) % mod; }
int main(int argc, char *argv[]) {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%s", mp[i] + 1);
  if (n == 1) {
    for (int i = 1; i <= m; ++i) {
      if (mp[1][i] == 'R') return puts("0"), 0;
    }
    return puts("1"), 0;
  }
  if (m == 1) {
    for (int i = 1; i <= n; ++i) {
      if (mp[i][1] == 'R') return puts("0"), 0;
    }
    return puts("1"), 0;
  }
  if (mp[n][m] == 'R') return puts("0"), 0;
  for (int i = n; i >= 1; --i) {
    for (int j = m; j >= 1; --j) {
      has[i][j][0] = has[i][j + 1][0] + (mp[i][j] == 'R');
      has[i][j][1] = has[i + 1][j][1] + (mp[i][j] == 'R');
    }
  }
  pre[n][m][0] = pre[n][m][1] = 1;
  dp[n][m][0] = dp[n][m][1] = 1;
  for (int i = n; i >= 1; --i) {
    for (int j = m; j >= 1; --j) {
      if (m - has[i][j + 1][0] >= j + 1) {
        dp[i][j][0] =
            (pre[i][j + 1][0] - pre[i][m - has[i][j + 1][0] + 1][0] + mod) %
            mod;
      }
      if (n - has[i + 1][j][1] >= i + 1) {
        dp[i][j][1] =
            (pre[i + 1][j][1] - pre[n - has[i + 1][j][1] + 1][j][1] + mod) %
            mod;
      }
      pre[i][j][0] = (pre[i][j + 1][0] + dp[i][j][1]) % mod;
      pre[i][j][1] = (pre[i + 1][j][1] + dp[i][j][0]) % mod;
    }
  }
  printf("%lld\n", (dp[1][1][0] + dp[1][1][1] + mod) % mod);
  return 0;
}
