#include <bits/stdc++.h>
const int N = 2e3 + 5, mo = 1e9 + 7;
int n, m, i, j, k, up[N][N], le[N][N], a[N][N], x;
char c[N][N];
int f1[N][N], f2[N][N], fs1[N][N], fs2[N][N];
int main() {
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; ++i)
    for (scanf("%s", c[i] + 1), j = 1; j <= m; ++j) a[i][j] = c[i][j] == 'R';
  if (a[n][m]) {
    puts("0");
    return 0;
  }
  if (n == 1 && m == 1) {
    puts("1");
    return 0;
  }
  x = 0;
  for (j = 1; j <= m; ++j) x += a[1][j];
  for (k = 2; k <= m - x; ++k) f2[1][k] = 1;
  x = 0;
  for (j = 1; j <= n; ++j) x += a[j][1];
  for (k = 2; k <= n - x; ++k) f1[k][1] = 1;
  for (k = 2; k <= m; ++k) fs1[1][k] = f2[1][k];
  for (k = 2; k <= n; ++k) fs2[k][1] = f1[k][1];
  for (i = 2; i <= n; ++i) {
    x = 0;
    for (j = 1; j <= m; ++j) x += a[i][j];
    for (j = k = 1; j <= m; ++j) {
      for (; k < j && m - j < x - a[i][k]; x -= a[i][k++])
        ;
      le[i][j] = k;
    }
  }
  for (i = 2; i <= m; ++i) {
    x = 0;
    for (j = 1; j <= n; ++j) x += a[j][i];
    for (j = k = 1; j <= n; ++j) {
      for (; k < j && n - j < x - a[k][i]; x -= a[k++][i])
        ;
      up[j][i] = k;
    }
  }
  for (j = 2; j <= n; ++j)
    for (k = 2; k <= m; ++k) {
      f2[j][k] = (fs2[j][k - 1] + mo - fs2[j][le[j][k] - 1]) % mo;
      f1[j][k] = (fs1[j - 1][k] + mo - fs1[up[j][k] - 1][k]) % mo;
      fs2[j][k] = (fs2[j][k - 1] + f1[j][k]) % mo;
      fs1[j][k] = (fs1[j - 1][k] + f2[j][k]) % mo;
    }
  printf("%d\n", (f1[n][m] + f2[n][m]) % mo);
  return 0;
}
