#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, m;
  cin >> n >> m;
  char grid[n + 1][m + 1];
  for (long long i = (1); i < (n + 1); i++) {
    for (long long j = (1); j < (m + 1); j++) cin >> grid[i][j];
  }
  long long rpos[n + 1][m + 1];
  for (long long i = (1); i < (n + 1); i++) {
    rpos[i][0] = m + 1;
    long long cnt = 0;
    for (long long j = (m); j > (0); j--) {
      if (grid[i][j] == 'R') {
        cnt++;
        rpos[i][cnt] = j;
      }
    }
    for (long long j = (cnt + 1); j < (m + 1); j++) rpos[i][j] = 1;
  }
  long long cpos[m + 1][n + 1];
  for (long long i = (1); i < (m + 1); i++) {
    cpos[i][0] = n + 1;
    long long cnt = 0;
    for (long long j = (n); j > (0); j--) {
      if (grid[j][i] == 'R') {
        cnt++;
        cpos[i][cnt] = j;
      }
    }
    for (long long j = (cnt + 1); j < (n + 1); j++) cpos[i][j] = 1;
  }
  long long dp[n + 1][m + 1][2], rpre[n + 1][m + 1], cpre[n + 1][m + 1];
  memset(dp, 0, sizeof(dp));
  memset(rpre, 0, sizeof(rpre));
  memset(cpre, 0, sizeof(cpre));
  for (long long i = (1); i < (n + 1); i++) {
    if (cpos[1][n - i + 1] == 1)
      dp[i][1][1] = 1, rpre[i][1] = 1;
    else
      break;
  }
  for (long long i = (1); i < (m + 1); i++) {
    if (rpos[1][m - i + 1] == 1)
      dp[1][i][0] = 1, cpre[1][i] = 1;
    else
      break;
  }
  for (long long i = (2); i < (n + 1); i++) {
    for (long long j = (2); j < (m + 1); j++) {
      long long x = rpos[i][m - j + 1] - 1;
      dp[i][j][0] = rpre[i][j - 1] - rpre[i][x];
      if (dp[i][j][0] < 0) dp[i][j][0] += 1000000007ll;
      cpre[i][j] = (cpre[i - 1][j] + dp[i][j][0]) % 1000000007ll;
      x = cpos[j][n - i + 1] - 1;
      dp[i][j][1] = cpre[i - 1][j] - cpre[x][j];
      if (dp[i][j][1] < 0) dp[i][j][1] += 1000000007ll;
      rpre[i][j] = (rpre[i][j - 1] + dp[i][j][1]) % 1000000007ll;
    }
  }
  if (n == 1 && m == 1)
    cout << 1;
  else
    cout << (dp[n][m][0] + dp[n][m][1]) % 1000000007ll;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  for (long long i = (1); i < (t + 1); i++) {
    solve();
    cout << "\n";
  }
}
