#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int t1[2001][2001], t2[2002][2002], RS[2002][2002], CS[2002][2002];
vector<string> F;
void update(int *tree, int n, int v) {
  for (; n <= 2000; n += n & -n) tree[n] = (tree[n] + v) % MOD;
}
int get_cnt(int *tree, int n) {
  int ret = 0;
  for (; n; n -= n & -n) ret = (ret + tree[n]) % MOD;
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ((void)0);
  ((void)0);
  ((void)0);
  int N, M;
  cin >> N >> M;
  if (N == 1 && M == 1) {
    cout << "1\n";
    return 0;
  }
  F.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> F[i];
    for (int j = M - 1; j >= 0; j--) {
      RS[i + 1][j + 1] = CS[i + 1][j + 1] = F[i][j] == 'R';
      RS[i + 1][j + 1] += RS[i + 1][j + 2];
    }
  }
  for (int j = 1; j <= M; j++)
    for (int i = N; --i;) CS[i][j] += CS[i + 1][j];
  update(t1[1], 1, 1);
  update(t1[1], 2, -1);
  update(t2[1], 1, 1);
  update(t2[1], 2, -1);
  for (int i = 1; i <= N; i++)
    for (int j = 1; j <= M; j++) {
      int cr = get_cnt(t2[j], i), cc = get_cnt(t1[i], j);
      if (cr && M - RS[i][j + 1] <= M) {
        update(t1[i], j + 1, cr);
        update(t1[i], M - RS[i][j + 1] + 1, MOD - cr);
      }
      if (cc && N - CS[i + 1][j] <= N) {
        update(t2[j], i + 1, cc);
        update(t2[j], N - CS[i + 1][j] + 1, MOD - cc);
      }
    }
  cout << (get_cnt(t1[N], M) + get_cnt(t2[M], N)) % MOD << '\n';
  return 0;
}
