#include <bits/stdc++.h>
using namespace std;
const int inf = ~0U >> 1;
const long long INF = ~0ULL >> 1;
template <class T>
inline void read(T &n) {
  char c;
  int flag = 1;
  for (c = getchar(); !((c >= '0' && c <= '9') || c == '-'); c = getchar()) {
  }
  if (c == '-')
    flag = -1, n = 0;
  else
    n = c - '0';
  for (c = getchar(); c >= '0' && c <= '9'; c = getchar()) n = n * 10 + c - '0';
  n *= flag;
}
const int maxn = 2500;
const int mo = 1000000007;
int n, m;
char grid[maxn][maxn];
int dp[maxn][maxn][3], row[maxn][maxn], column[maxn][maxn];
int rt[maxn][maxn], down[maxn][maxn];
void add(int &x, int y) { x = (x + y) % mo; }
int main(int argc, char *argv[]) {
  scanf("%d%d", &n, &m);
  if (n == 1 && m == 1) {
    puts("1");
    return 0;
  }
  for (int i = (1); i <= (n); ++i) scanf("%s", grid[i] + 1);
  dp[1][1][0] = dp[1][1][1] = 1;
  for (int i = (1); i <= (n); ++i) {
    rt[i][m] = m;
    for (int j = (m - 1); j >= (1); --j) {
      rt[i][j] = rt[i][j + 1];
      if (grid[i][j + 1] == 'R') rt[i][j]--;
    }
  }
  for (int j = (1); j <= (m); ++j) {
    down[n][j] = n;
    for (int i = (n - 1); i >= (1); --i) {
      down[i][j] = down[i + 1][j];
      if (grid[i + 1][j] == 'R') down[i][j]--;
    }
  }
  for (int i = (1); i <= (n); ++i) {
    for (int j = (1); j <= (m); ++j) {
      add(dp[i][j][0], row[i][j]);
      add(dp[i][j][1], column[i][j]);
      if (i == n && j == m) {
        int ans = 0;
        for (int k = (0); k <= (1); ++k) add(ans, dp[n][m][k]);
        printf("%d\n", ans);
        return 0;
      }
      add(row[i][j + 1], dp[i][j][1]);
      add(row[i][rt[i][j] + 1], mo - dp[i][j][1]);
      add(column[i + 1][j], dp[i][j][0]);
      add(column[down[i][j] + 1][j], mo - dp[i][j][0]);
      add(row[i][j + 1], row[i][j]);
      add(column[i + 1][j], column[i][j]);
    }
  }
  return 0;
}
