#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2007;
const int mod = 1e9 + 7;
void add(int &x, const int &y) {
  x += y;
  if (x >= mod) x -= mod;
}
int sub(const int &x, const int &y) {
  int k = x - y;
  if (k < 0) k += mod;
  return k;
}
int M, N;
int numRockInCol[MAXN][MAXN], numRockInRow[MAXN][MAXN];
void Input() {
  cin >> M >> N;
  for (int i = 1; i <= M; i++)
    for (int j = 1; j <= N; j++) {
      char x;
      cin >> x;
      numRockInRow[i][j] = numRockInRow[i][j - 1] + (x == 'R');
      numRockInCol[i][j] = numRockInCol[i - 1][j] + (x == 'R');
    }
}
int GetCol(const int &x, const int &y, int const &col) {
  return numRockInCol[y][col] - numRockInCol[x - 1][col];
}
int GetRow(const int &x, const int &y, const int &row) {
  return numRockInRow[row][y] - numRockInRow[row][x - 1];
}
int dp[MAXN][MAXN][2];
int sumRow[MAXN][MAXN];
int sumCol[MAXN][MAXN];
void Output() {
  if (M == 1 && N == 1) {
    if (numRockInRow[1][1])
      cout << 0;
    else
      cout << 1;
    return;
  }
  dp[1][1][0] = dp[1][1][1] = 1;
  for (int i = 1; i <= M; i++) {
    for (int j = 1; j <= N; j++) {
      int l = 1, r = j - 1;
      int ans = j;
      sumCol[i][j] += sumCol[i - 1][j];
      while (l <= r) {
        int mid = (l + r) >> 1;
        if (GetRow(mid + 1, N, i) <= N - j) {
          r = mid - 1;
          ans = mid;
        } else
          l = mid + 1;
      }
      add(dp[i][j][0], sub(sumRow[i][j - 1], sumRow[i][ans - 1]));
      add(sumCol[i][j], dp[i][j][0]);
      l = 1, r = i - 1;
      ans = i;
      sumRow[i][j] += sumRow[i][j - 1];
      while (l <= r) {
        int mid = (l + r) >> 1;
        if (GetCol(mid + 1, M, j) <= M - i) {
          r = mid - 1;
          ans = mid;
        } else
          l = mid + 1;
      }
      add(dp[i][j][1], sub(sumCol[i - 1][j], sumCol[ans - 1][j]));
      add(sumRow[i][j], dp[i][j][1]);
    }
  }
  cout << (dp[M][N][0] + dp[M][N][1]) % mod;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  Input();
  Output();
  return 0;
}
