#include <bits/stdc++.h>
using namespace std;
int dis[2][2005][2005], dp[2][2005][2005], pre[2][2005][2005], n, m;
char s[2005][2005];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%s", s[i] + 1);
    for (int j = m - 1; j > 0; j--)
      dis[0][i][j] = dis[0][i][j + 1] + (s[i][j + 1] == '.');
  }
  for (int i = n - 1; i > 0; i--)
    for (int j = 1; j <= m; j++)
      dis[1][i][j] = dis[1][i + 1][j] + (s[i + 1][j] == '.');
  dp[1][1][1] = dp[0][1][1] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      if (i != 1 || j != 1) {
        dp[0][i][j] =
            ((i - 1 == 1 && j == 1 ? 0 : dp[0][i - 1][j]) + pre[0][i][j]) %
            1000000007;
        dp[1][i][j] =
            ((i == 1 && j - 1 == 1 ? 0 : dp[1][i][j - 1]) + pre[1][i][j]) %
            1000000007;
      }
      (pre[1][i][j + 1] += dp[0][i][j]) %= 1000000007;
      (pre[1][i][j + dis[0][i][j] + 1] += 1000000007 - dp[0][i][j]) %=
          1000000007;
      (pre[0][i + 1][j] += dp[1][i][j]) %= 1000000007;
      (pre[0][i + dis[1][i][j] + 1][j] += 1000000007 - dp[1][i][j]) %=
          1000000007;
    }
  printf("%d", n == 1 && m == 1 ? 1 : (dp[0][n][m] + dp[1][n][m]) % 1000000007);
  return 0;
}
