#include <bits/stdc++.h>
using namespace std;
const long long maxn = 2e3 + 5;
const long long lg = 20;
const long long mod = 1e9 + 7;
const long long INF = 1e18 + 1;
long long a[maxn][maxn];
long long pref[maxn][maxn];
long long dppref[maxn][maxn][2];
long long dp[maxn][maxn][2];
long long get(long long i1, long long j1, long long i2, long long j2) {
  if (i1 > i2 || j1 > j2) return 0;
  return pref[i2][j2] - pref[i1 - 1][j2] - pref[i2][j1 - 1] +
         pref[i1 - 1][j1 - 1];
}
long long getdp(long long i1, long long j1, long long i2, long long j2,
                long long id) {
  if (j1 > j2 || i1 > i2) return 0;
  long long ret = dppref[i2][j2][id] - dppref[i1 - 1][j2][id] -
                  dppref[i2][j1 - 1][id] + dppref[i1 - 1][j1 - 1][id];
  ret %= mod;
  ret += mod;
  ret %= mod;
  return ret;
}
void rel(long long i, long long j, long long id) {
  dppref[i][j][id] = dp[i][j][id] + dppref[i - 1][j][id] +
                     dppref[i][j - 1][id] - dppref[i - 1][j - 1][id];
  dppref[i][j][id] %= mod;
  dppref[i][j][id] += mod;
  dppref[i][j][id] %= mod;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, m;
  cin >> n >> m;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= m; j++) {
      char x;
      cin >> x;
      a[i][j] = (x == 'R');
      pref[i][j] =
          a[i][j] + pref[i - 1][j] + pref[i][j - 1] - pref[i - 1][j - 1];
    }
  }
  dppref[1][1][0] = dp[1][1][0] = 1;
  dppref[1][1][1] = dp[1][1][1] = 1;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= m; j++) {
      if (i == 1 && j == 1) continue;
      long long lf = 0, rg = j;
      while (rg - lf > 1) {
        long long md = lf + rg >> 1;
        if (get(i, md + 1, i, j) > m - j - get(i, j + 1, i, m))
          lf = md;
        else
          rg = md;
      }
      dp[i][j][0] = getdp(i, rg, i, j - 1, 1);
      rel(i, j, 0);
      lf = 0, rg = i;
      while (rg - lf > 1) {
        long long md = lf + rg >> 1;
        if (get(md + 1, j, i, j) > n - i - get(i + 1, j, n, j))
          lf = md;
        else
          rg = md;
      }
      dp[i][j][1] = getdp(rg, j, i - 1, j, 0);
      rel(i, j, 1);
    }
  }
  if (n == 1 && m == 1)
    cout << 1;
  else
    cout << (dp[n][m][0] + dp[n][m][1]) % mod;
  return 0;
}
