#include <bits/stdc++.h>
using namespace std;
const int maxTS = 1 << 12, maxN = 1 << 11, mod = 1000000007;
inline void addMod(long long& a, long long b) { a = (a + b) % mod; }
struct Tree {
  int offset, qbegin, qend;
  long long T[maxTS], x;
  void qpriv(int v, int left, int right) {
    if (left >= qend or right <= qbegin) return;
    if (left >= qbegin and right <= qend) {
      T[v] += x;
      return;
    }
    qpriv(v * 2, left, (left + right) / 2);
    qpriv(v * 2 + 1, (left + right) / 2, right);
  }
  void resize(int n) {
    for (offset = 1; offset < n; offset *= 2)
      ;
  }
  void add(int a, int b, long long c) {
    qbegin = a + offset;
    qend = b + offset;
    x = c;
    qpriv(1, offset, offset * 2);
  }
  long long query(int v) {
    long long res = 0;
    for (v += offset; v != 0; v /= 2) res += T[v];
    return res % mod;
  }
} treeHor[maxN], treeVer[maxN];
int ileP[maxN][maxN], ileD[maxN][maxN];
char in[maxN][maxN];
long long solve() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = (0); i < (int)(n); i++) treeHor[i].resize(m);
  for (int i = (0); i < (int)(m); i++) treeVer[i].resize(n);
  for (int i = (0); i < (int)(n); i++) scanf("%s", in[i]);
  if (n * m == 1) return 1;
  for (int i = (0); i < (int)(n); i++) in[i][m] = '.';
  for (int i = (0); i < (int)(m + 1); i++) in[n][i] = '.';
  for (int i = n - 1; i >= 0; i--)
    for (int j = m - 1; j >= 0; j--) {
      ileP[i][j] = ileP[i][j + 1] + (in[i][j + 1] == 'R');
      ileD[i][j] = ileD[i + 1][j] + (in[i + 1][j] == 'R');
    }
  treeHor[0].add(0, 1, 1);
  treeVer[0].add(0, 1, 1);
  for (int i = (0); i < (int)(n); i++)
    for (int j = (0); j < (int)(m); j++) {
      long long x = treeVer[j].query(i);
      treeHor[i].add(j + 1, m - ileP[i][j], x);
      x = treeHor[i].query(j);
      treeVer[j].add(i + 1, n - ileD[i][j], x);
    }
  long long res = treeHor[n - 1].query(m - 1);
  addMod(res, treeVer[m - 1].query(n - 1));
  return res;
}
int main() {
  int t;
  t = 1;
  while (t--) printf("%lld\n", solve());
  return 0;
}
