#include <bits/stdc++.h>
const int mod = 1000000007;
inline int add(int a, int b) { return a < mod - b ? a + b : a - (mod - b); }
inline int sub(int a, int b) { return a < b ? a + (mod - b) : a - b; }
class conve : public std::queue<int> {
 protected:
  int sum;

 public:
  conve() : sum() {}
  conve(const conve &cv) : std::queue<int>(cv), sum(cv.sum) {}
  conve(conve &&cv) : std::queue<int>(static_cast<conve &&>(cv)), sum(cv.sum) {}
  void push(int v) {
    sum = add(sum, v);
    std::queue<int>::push(v);
  }
  void pop() {
    sum = sub(sum, front());
    std::queue<int>::pop();
  }
  operator int() const { return sum; }
  conve &operator=(const conve &cv) {
    std::queue<int>::operator=(cv);
    sum = cv.sum;
    return *this;
  }
  conve &operator=(conve &&cv) {
    std::queue<int>::operator=(static_cast<conve &&>(cv));
    sum = cv.sum;
    return *this;
  }
};
int sx, sy;
char map[2000][2000 + 1];
int xg[2000][2000], yg[2000][2000], v[2000];
int vxs[2000];
conve vy[2000];
int main() {
  scanf("%d%d", &sy, &sx);
  if (sy > 2000 || sx > 2000) return -1;
  for (int i = 0; i < sy; ++i) scanf("%s", map + i);
  for (int y = sy - 1; y >= 0; --y)
    for (int x = sx - 1; x >= 0; --x) {
      xg[y][x] += (x + 1 < sx ? xg[y][x + 1] : 0) + (map[y][x] == 'R' ? 1 : 0);
      yg[y][x] += (y + 1 < sy ? yg[y + 1][x] : 0) + (map[y][x] == 'R' ? 1 : 0);
    }
  for (int y = 0; y < sy; ++y) {
    conve vx;
    for (int x = 0; x < sx; ++x)
      if (map[y][x] == 'R') {
        if (y > 0) {
          if (yg[y][x] + y < sy) vy[x].push(add(v[x - 0], vxs[x - 0]));
          while (y + (yg[y][x] - 1) + (int)vy[x].size() >= sy) vy[x].pop();
        }
        if (x > 0) {
          if (xg[y][x] + x < sx) vx.push(add(v[x - 1], vy[x - 1]));
          while (x + (xg[y][x] - 1) + (int)vx.size() >= sx) vx.pop();
        }
        v[x] = 0;
        vxs[x] = vx;
      } else {
        int vv = x == 0 && y == 0 ? 1 : 0;
        if (y > 0) {
          if (yg[y][x] + y < sy) vv = add(vv, add(v[x - 0], vxs[x - 0]));
          while (y + (yg[y][x] - 0) + (int)vy[x].size() >= sy) vy[x].pop();
        }
        if (x > 0) {
          if (xg[y][x] + x < sx) vv = add(vv, add(v[x - 1], vy[x - 1]));
          while (x + (xg[y][x] - 0) + (int)vx.size() >= sx) vx.pop();
        }
        v[x] = vv;
        vxs[x] = vx;
      }
  }
  printf("%d\n", v[sx - 1]);
  return 0;
}
