#include <bits/stdc++.h>
using namespace std;
long long n, m;
char a[2005][2005];
long long w[2005][2005];
long long s[2005][2005], s2[2005][2005];
long long f[2005][2005][2];
long long re[2005][2005];
long long d[2005][2005];
signed main() {
  cin >> n >> m;
  if (n == 1 && m == 1) {
    cout << 1;
    return 0;
  }
  for (long long i = 1; i <= n; i++)
    for (long long j = 1; j <= m; j++) cin >> a[i][j];
  for (long long i = 1; i <= n; i++)
    for (long long j = 1; j <= m; j++) {
      if (a[i][j] == 'R')
        w[i][j] = 1;
      else
        w[i][j] = 0;
    }
  f[1][1][1] = f[1][1][0] = 1;
  s[1][1] = s2[1][1] = 1;
  for (long long i = 1; i <= n; i++)
    for (long long j = m; j >= 1; j--) re[i][j] = re[i][j + 1] + w[i][j + 1];
  for (long long i = n; i >= 1; i--)
    for (long long j = 1; j <= m; j++) d[i][j] = d[i + 1][j] + w[i + 1][j];
  for (register long long i = 1; i <= n; i++)
    for (register long long j = 1; j <= m; j++) {
      if (i == 1 && j == 1) continue;
      long long l = 0, r = j;
      while (l < r) {
        long long mid = (l + r) >> 1;
        if (re[i][mid] > m - j)
          l = mid + 1;
        else
          r = mid;
      }
      if (l < j) {
        f[i][j][0] =
            (f[i][j][0] + (s[i][j - 1] - ((l == 0) ? 0 : s[i][l - 1])) +
             1000000007) %
            1000000007;
      }
      l = 0, r = i;
      while (l < r) {
        long long mid = l + r >> 1;
        if (d[mid][j] <= n - i)
          r = mid;
        else
          l = mid + 1;
      }
      if (l < i) {
        f[i][j][1] =
            (f[i][j][1] + (s2[i - 1][j] - ((l == 0) ? 0 : s2[l - 1][j])) +
             1000000007) %
            1000000007;
      }
      s[i][j] = s[i][j - 1] + f[i][j][1];
      if (s[i][j] >= 1000000007) s[i][j] -= 1000000007;
      s2[i][j] = s2[i - 1][j] + f[i][j][0];
      if (s2[i][j] >= 1000000007) s2[i][j] -= 1000000007;
    }
  long long ans = f[n][m][1] + f[n][m][0];
  if (ans >= 1000000007) ans -= 1000000007;
  printf("%lld\n", ans);
  return 0;
}
