#include <bits/stdc++.h>
using namespace std;
template <typename T>
void __read(T &a) {
  cin >> a;
}
template <typename T, typename... Args>
void __read(T &a, Args &...args) {
  cin >> a;
  __read(args...);
}
constexpr long long M7 = 1000000007ll;
constexpr long long M9 = 1000000009ll;
constexpr long long MFFT = 998244353ll;
template <class T>
void outv(T &a) {
  for (auto &x : a) cout << x << ' ';
}
static mt19937 rnd(static_cast<unsigned>(
    chrono::steady_clock::now().time_since_epoch().count()));
int32_t main() {
  ios_base::sync_with_stdio(false), cin.tie(nullptr);
  long long n, m;
  __read(n, m);
  vector<vector<long long>> a(n, vector<long long>(m));
  for (long long i = 0; i < n; ++i) {
    string s;
    __read(s);
    for (long long j = 0; j < m; ++j) {
      a[i][j] = s[j] == 'R';
    }
  }
  if (n == 1 && m == 1) {
    cout << 1;
    return 0;
  }
  vector<long long> cnt[]{vector<long long>(n), vector<long long>(m)};
  for (long long i = 0; i < n; ++i) {
    for (long long j = 0; j < m; ++j) {
      cnt[0][i] += a[i][j];
      cnt[1][j] += a[i][j];
    }
  }
  vector<vector<long long>> pos[]{
      vector<vector<long long>>(n, vector<long long>(m)),
      vector<vector<long long>>(m, vector<long long>(n))};
  for (long long i = 0; i < n; ++i) {
    for (long long j = 0; j < m; ++j) {
      if (a[i][j] == 1) {
        cnt[0][i]--;
        pos[0][i][cnt[0][i]] = j;
      }
    }
  }
  for (long long j = 0; j < m; ++j) {
    for (long long i = 0; i < n; ++i) {
      if (a[i][j] == 1) {
        cnt[1][j]--;
        pos[1][j][cnt[1][j]] = i;
      }
    }
  }
  vector<vector<long long>> dp[]{
      vector<vector<long long>>(n, vector<long long>(m)),
      vector<vector<long long>>(n, vector<long long>(m))};
  vector<vector<long long>> sdp[]{
      vector<vector<long long>>(n + 1, vector<long long>(m)),
      vector<vector<long long>>(n, vector<long long>(m + 1))};
  dp[0][0][0] = dp[1][0][0] = 1;
  for (long long i = 1; i <= n; ++i) {
    sdp[0][i][0] = 1;
  }
  for (long long j = 1; j <= m; ++j) {
    sdp[1][0][j] = 1;
  }
  sdp[0][1][0] = sdp[1][0][1] = 1;
  for (long long i = 0; i < n; ++i) {
    for (long long j = 0; j < m; ++j) {
      if (j > 0) {
        dp[0][i][j] =
            (sdp[1][i][j] - sdp[1][i][pos[0][i][m - j - 1]] + M7) % M7;
        sdp[0][i + 1][j] = (sdp[0][i][j] + dp[0][i][j]) % M7;
      }
      if (i > 0) {
        dp[1][i][j] =
            (sdp[0][i][j] - sdp[0][pos[1][j][n - i - 1]][j] + M7) % M7;
        sdp[1][i][j + 1] = (sdp[1][i][j] + dp[1][i][j]) % M7;
      }
    }
  }
  cout << (dp[0][n - 1][m - 1] + dp[1][n - 1][m - 1]) % M7;
  return 0;
}
