#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  long long n, m;
  cin >> n >> m;
  vector<vector<long long>> a((size_t)n, vector<long long>((size_t)m, 0));
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < m; j++) {
      char c;
      cin >> c;
      if (c == 'R') {
        a[i][j] = 1;
      }
    }
  }
  vector<vector<vector<long long>>> b(
      (size_t)2,
      vector<vector<long long>>((size_t)n, vector<long long>((size_t)m, 0)));
  for (long long i = n - 1; i >= 0; i--) {
    for (long long j = m - 1; j >= 0; j--) {
      b[0][i][j] = (i == n - 1 ? 0 : b[0][i + 1][j]) + a[i][j];
      b[1][i][j] = (j == m - 1 ? 0 : b[1][i][j + 1]) + a[i][j];
    }
  }
  vector<vector<vector<long long>>> c(
      (size_t)2,
      vector<vector<long long>>((size_t)n, vector<long long>((size_t)m, 0)));
  c[0][n - 1][m - 1] = 1 - a[n - 1][m - 1];
  c[1][n - 1][m - 1] = 1 - a[n - 1][m - 1];
  for (long long i = n - 1; i >= 0; i--) {
    for (long long j = m - 1; j >= 0; j--) {
      if (j != m - 1) {
        c[0][i][j] =
            (((i == n - 1 ? 0 : c[0][i + 1][j]) + c[1][i][j + 1] -
              (b[1][i][j + 1] == 0 ? 0 : c[1][i][m - b[1][i][j + 1]])) %
                 1000000007 +
             1000000007) %
            1000000007;
      } else if (i != n - 1) {
        c[0][i][j] = c[0][i + 1][j];
      }
      if (i != n - 1) {
        c[1][i][j] =
            (((j == m - 1 ? 0 : c[1][i][j + 1]) + c[0][i + 1][j] -
              (b[0][i + 1][j] == 0 ? 0 : c[0][n - b[0][i + 1][j]][j])) %
                 1000000007 +
             1000000007) %
            1000000007;
      } else if (j != m - 1) {
        c[1][i][j] = c[1][i][j + 1];
      }
    }
  }
  cout << ((n == 1 || m == 1
                ? 1 - min(b[0][0][0] + b[1][0][0], (long long)1)
                : (c[0][0][0] - c[0][1][0]) + (c[1][0][0] - c[1][0][1])) %
               1000000007 +
           1000000007) %
              1000000007
       << endl;
  return 0;
}
