#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long a = 0, f = 1;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) a = (a << 3) + (a << 1) + ch - '0';
  return a * f;
}
const long long mod = 1e9 + 7;
const long long N = 2e3 + 5;
const long long inf = 0x3f3f3f3f;
char mp[N][N];
long long l[N][N], h[N][N];
long long L[N][N], H[N][N];
long long f[2][N][N], n, m;
signed main() {
  n = read();
  m = read();
  for (long long i = 1; i <= n; i++) {
    char ch = getchar();
    long long j = 0;
    for (; ch != '.' && ch != 'R'; ch = getchar())
      ;
    for (; ch == '.' || ch == 'R'; ch = getchar()) mp[i][++j] = ch;
  }
  for (long long i = 1; i <= n; i++)
    for (long long j = m; j >= 1; j--)
      h[i][j] = h[i][j + 1] + (mp[i][j] == '.');
  for (long long i = n; i >= 1; i--)
    for (long long j = 1; j <= m; j++)
      l[i][j] = l[i + 1][j] + (mp[i][j] == '.');
  f[0][1][1] = f[1][1][1] = 1;
  for (long long i = 1; i <= n; i++)
    for (long long j = 1; j <= m; j++) {
      H[i][j] = (H[i][j] + H[i][j - 1]) % mod;
      L[i][j] = (L[i][j] + L[i - 1][j]) % mod;
      if (i != 1 || j != 1) {
        f[1][i][j] = H[i][j];
        f[0][i][j] = L[i][j];
      }
      H[i][j + 1] = (H[i][j + 1] + f[0][i][j]) % mod;
      H[i][j + h[i][j + 1] + 1] =
          (H[i][j + h[i][j + 1] + 1] - f[0][i][j]) % mod;
      L[i + 1][j] = (L[i + 1][j] + f[1][i][j]) % mod;
      L[i + l[i + 1][j] + 1][j] =
          (L[i + l[i + 1][j] + 1][j] - f[1][i][j]) % mod;
    }
  if (n == 1 && m == 1) return puts("1"), 0;
  long long ans = (f[0][n][m] + f[1][n][m]) % mod;
  printf("%lld\n", (ans + mod) % mod);
  return 0;
}
