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>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
long long MOD = 1000000007;
long double EPS = 1e-9;
long long binpow(long long b, long long p, long long mod) {
  long long ans = 1;
  b %= mod;
  for (; p; p >>= 1) {
    if (p & 1) ans = ans * b % mod;
    b = b * b % mod;
  }
  return ans;
}
void pre() {}
template <int MOD>
struct mod_int {
  static const int mod = MOD;
  unsigned x;
  mod_int() : x(0) {}
  mod_int(int sig) {
    int sigt = sig % MOD;
    if (sigt < 0) sigt += MOD;
    x = sigt;
  }
  mod_int(long long sig) {
    int sigt = sig % MOD;
    if (sigt < 0) sigt += MOD;
    x = sigt;
  }
  int get() const { return (int)x; }
  mod_int& operator+=(mod_int that) {
    if ((x += that.x) >= MOD) x -= MOD;
    return *this;
  }
  mod_int& operator-=(mod_int that) {
    if ((x += MOD - that.x) >= MOD) x -= MOD;
    return *this;
  }
  mod_int& operator*=(mod_int that) {
    x = (unsigned long long)x * that.x % MOD;
    return *this;
  }
  mod_int& operator/=(mod_int that) { return *this *= that.inverse(); }
  mod_int operator+(mod_int that) const { return mod_int(*this) += that; }
  mod_int operator-(mod_int that) const { return mod_int(*this) -= that; }
  mod_int operator*(mod_int that) const { return mod_int(*this) *= that; }
  mod_int operator/(mod_int that) const { return mod_int(*this) /= that; }
  mod_int inverse() const {
    long long a = x, b = MOD, u = 1, v = 0;
    while (b) {
      long long t = a / b;
      a -= t * b;
      swap(a, b);
      u -= t * v;
      swap(u, v);
    }
    return mod_int(u);
  }
};
template <int MOD>
istream& operator>>(istream& is, mod_int<MOD>& val) {
  long long x;
  is >> x;
  val = x;
  return is;
}
template <int MOD>
ostream& operator<<(ostream& os, const mod_int<MOD>& val) {
  os << val.get();
  return os;
}
using mint = mod_int<1000000007>;
template <typename T>
T binpow(T b, long long k) {
  T ans = T(1);
  for (; k; k >>= 1) {
    if (k & 1) ans = ans * b;
    b = b * b;
  }
  return ans;
}
int n, m;
vector<string> arr;
mint dp[2020][2020][2];
mint delta[2020][2020][2];
int rowcnt[2020][2020];
int colcnt[2020][2020];
void solve() {
  cin >> n >> m;
  arr.resize(n);
  for (long long i = 0; i < (n); ++i) cin >> arr[i];
  for (long long i = 0; i < (n); ++i)
    for (long long j = 0; j < (m); ++j) {
      if (arr[i][j] == 'R') {
        rowcnt[i][j] = 1;
        colcnt[i][j] = 1;
      }
    }
  for (long long i = n - 1; i >= 0; i--) {
    for (long long j = m - 1; j >= 0; j--) {
      colcnt[i][j] += colcnt[i][j + 1];
      rowcnt[i][j] += rowcnt[i + 1][j];
    }
  }
  if (n == 1 & m == 1) {
    cout << 1 << '\n';
    return;
  }
  dp[0][0][0] = 1;
  dp[0][0][1] = 1;
  for (long long i = 0; i < (n); ++i)
    for (long long j = 0; j < (m); ++j) {
      dp[i][j][0] += delta[i][j][0];
      delta[i][j + 1][0] += delta[i][j][0];
      dp[i][j][1] += delta[i][j][1];
      delta[i + 1][j][1] += delta[i][j][1];
      {
        int blcnt = rowcnt[i + 1][j];
        int lo = i + 1, hi = n - 1 - blcnt;
        if (lo <= hi) {
          delta[lo][j][1] += dp[i][j][0];
          delta[hi + 1][j][1] -= dp[i][j][0];
        }
      }
      {
        int blcnt = colcnt[i][j + 1];
        int lo = j + 1, hi = m - 1 - blcnt;
        if (lo <= hi) {
          delta[i][lo][0] += dp[i][j][1];
          delta[i][hi + 1][0] -= dp[i][j][1];
        }
      }
    }
  cout << dp[n - 1][m - 1][0] + dp[n - 1][m - 1][1] << '\n';
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  pre();
  long long _t = 1;
  for (long long i = 1; i <= _t; i++) {
    solve();
  }
}
