You are at the top left cell (1, 1) of an n × m labyrinth. Your goal is to get to the bottom right cell (n, m). You can only move right or down, one cell per step. Moving right from a cell (x, y) takes you to the cell (x, y + 1), while moving down takes you to the cell (x + 1, y).

Some cells of the labyrinth contain rocks. When you move to a cell with rock, the rock is pushed to the next cell in the direction you're moving. If the next cell contains a rock, it gets pushed further, and so on.

The labyrinth is surrounded by impenetrable walls, thus any move that would put you or any rock outside of the labyrinth is illegal.

Count the number of different legal paths you can take from the start to the goal modulo 10^9 + 7. Two paths are considered different if there is at least one cell that is visited in one path, but not visited in the other.

Input

The first line contains two integers n, m — dimensions of the labyrinth (1 ≤ n, m ≤ 2000).

Next n lines describe the labyrinth. Each of these lines contains m characters. The j-th character of the i-th of these lines is equal to "R" if the cell (i, j) contains a rock, or "." if the cell (i, j) is empty.

It is guaranteed that the starting cell (1, 1) is empty.

Output

Print a single integer — the number of different legal paths from (1, 1) to (n, m) modulo 10^9 + 7.

Examples

Input


1 1
.


Output


1


Input


2 3
...
..R


Output


0


Input


4 4
...R
.RR.
.RR.
R...


Output


4

Note

In the first sample case we can't (and don't have to) move, hence the only path consists of a single cell (1, 1).

In the second sample case the goal is blocked and is unreachable.

Illustrations for the third sample case can be found here: <https://assets.codeforces.com/rounds/1225/index.html>
#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007LL;
int n, m;
vector<string> mat;
long long dp[2005][2005][2];
int sumr[2005][2005];
int sumc[2005][2005];
deque<pair<int, long long>> dq[2005];
long long tot[2005];
int main() {
  cin >> n >> m;
  mat.clear();
  memset(sumr, 0, sizeof(sumr));
  memset(sumc, 0, sizeof(sumc));
  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    mat.push_back(s);
  }
  if (n == 1 && m == 1) {
    cout << 1 << endl;
    return 0;
  }
  for (int i = 0; i < n; ++i) {
    for (int j = m - 1; j >= 0; --j) {
      sumr[i][j] = sumr[i][j + 1] + (mat[i][j] == 'R');
    }
  }
  for (int j = 0; j < m; ++j) {
    for (int i = n - 1; i >= 0; --i) {
      sumc[j][i] = sumc[j][i + 1] + (mat[i][j] == 'R');
    }
  }
  for (int j = 0; j < m; ++j) {
    dq[j].clear();
  }
  memset(tot, 0, sizeof(tot));
  memset(dp, 0, sizeof(dp));
  dp[0][0][0] = dp[0][0][1] = 1;
  deque<pair<int, long long>> cdq;
  cdq.clear();
  long long csum = 0;
  for (int i = 0; i < n; ++i) {
    csum = 0;
    cdq.clear();
    for (int j = 0; j < m; ++j) {
      if (i == 0 && j == 0) {
        dq[j].push_back(make_pair(i, dp[i][j][0]));
        tot[j] = (tot[j] + dp[i][j][0]) % mod;
        cdq.push_back(make_pair(j, dp[i][j][1]));
        csum = (csum + dp[i][j][1]) % mod;
      } else {
        while (!dq[j].empty()) {
          auto p = dq[j].front();
          int id = p.first;
          if (sumc[j][id + 1] > n - 1 - i) {
            dq[j].pop_front();
            tot[j] = (tot[j] - p.second + mod) % mod;
          } else {
            break;
          }
        }
        dp[i][j][1] = (dp[i][j][1] + tot[j]) % mod;
        while (!cdq.empty()) {
          auto p = cdq.front();
          int id = p.first;
          if (sumr[i][id + 1] > m - 1 - j) {
            cdq.pop_front();
            csum = (csum - p.second + mod) % mod;
          } else {
            break;
          }
        }
        dp[i][j][0] = (dp[i][j][0] + csum) % mod;
        cdq.push_back(make_pair(j, dp[i][j][1]));
        csum = (csum + dp[i][j][1]) % mod;
        dq[j].push_back(make_pair(i, dp[i][j][0]));
        tot[j] = (tot[j] + dp[i][j][0]) % mod;
      }
    }
  }
  cout << (dp[n - 1][m - 1][0] + dp[n - 1][m - 1][1]) % mod << endl;
  return 0;
}
