#include <bits/stdc++.h>
using namespace std;
int n, m;
char ch[2008][2008];
int dp[2008][2008][2];
int sum1[2008][2008], sum2[2008][2008];
int sumdp1[2008][2008], sumdp2[2008][2008];
int l0[2008], l1[2008];
const int mod = 1e9 + 7;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%s", ch[i] + 1);
  if (n == 1 && m == 1) {
    cout << 1 << endl;
    return 0;
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      sum1[i][j] = sum1[i][j - 1];
      if (ch[i][j] != 'R') {
        sum1[i][j]++;
      }
      sum2[i][j] = sum2[i - 1][j];
      if (ch[i][j] != 'R') {
        sum2[i][j]++;
      }
    }
  for (int i = 1; i <= n; i++) l1[i] = 1;
  for (int i = 1; i <= m; i++) l0[i] = 1;
  dp[1][1][0] = 1;
  dp[1][1][1] = 1;
  sumdp2[1][1] = 1;
  sumdp1[1][1] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (i == 1 && j == 1) {
        continue;
      }
      sumdp1[i][j] = (sumdp1[i][j - 1]);
      sumdp2[i][j] = (sumdp2[i - 1][j]);
      int k = sum2[n][j] - sum2[i][j];
      int t = sum1[i][m] - sum1[i][j];
      bool flag1 = false, flag2 = false;
      while (i - l0[j] + 1 - (sum2[i][j] - sum2[l0[j] - 1][j]) -
                     (ch[l0[j]][j] == 'R') >
                 k &&
             l0[j] < i)
        l0[j]++, flag1 = 1;
      while (j - l1[i] + 1 - (sum1[i][j] - sum1[i][l1[i] - 1]) -
                     (ch[i][l1[i]] == 'R') >
                 t &&
             l1[i] < j)
        l1[i]++, flag2 = 1;
      (dp[i][j][0] += sumdp2[i][j] - sumdp2[l0[j] - 1][j] + mod) %= mod;
      (dp[i][j][1] += sumdp1[i][j] - sumdp1[i][l1[i] - 1] + mod) %= mod;
      (sumdp1[i][j] += dp[i][j][0]) %= mod;
      (sumdp2[i][j] += dp[i][j][1]) %= mod;
    }
  }
  printf("%d\n", (dp[n][m][0] + dp[n][m][1]) % mod);
}
