#include <bits/stdc++.h>
using namespace std;
int table[2000][2000];
int sum[2000][2000];
long long int DP[2000][2000][2];
int n, m;
long long int get(int a, int b) {
  if (a >= n || b >= m) return 0;
  return sum[a][b];
}
long long int CALC(int x, int y, int z, int w) {
  if (x > z || y > w) return 0;
  z++;
  w++;
  return get(x, y) + get(z, w) - get(z, y) - get(x, w);
}
long long int getDP(int a, int b, int Z) {
  if (a >= n || b >= m) return 0;
  return DP[a][b][Z];
}
long long int CALCDP(int x, int y, int z, int w, int Z) {
  if (x > z || y > w) return 0;
  z++;
  w++;
  return getDP(x, y, Z) + getDP(z, w, Z) - getDP(z, y, Z) - getDP(x, w, Z);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    for (int j = 0; j < m; j++) {
      if (s[j] == '.')
        table[i][j] = 0;
      else
        table[i][j] = 1;
    }
  }
  if (n == 1 && m == 1) {
    cout << 1 << endl;
    return 0;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) sum[i][j] = table[i][j];
  }
  for (int i = n - 1; i > -1; i--) {
    for (int j = m - 1; j > -1; j--) {
      if (i < n - 1) sum[i][j] += sum[i + 1][j];
      if (j < m - 1) sum[i][j] += sum[i][j + 1];
      if (i < n - 1 && j < m - 1) sum[i][j] -= sum[i + 1][j + 1];
    }
  }
  for (int i = n - 1; i > -1; i--) {
    for (int j = m - 1; j > -1; j--) {
      if (i == n - 1 && j == m - 1) {
        DP[i][j][0] = 1;
        DP[i][j][1] = 1;
      } else {
        long long int rocks = CALC(i, j + 1, i, m - 1);
        long long int COUNT = CALCDP(i, j + 1, i, m - 1 - rocks, 1);
        DP[i][j][0] += COUNT;
        if (i < n - 1) DP[i][j][0] += DP[i + 1][j][0];
        if (j < m - 1) DP[i][j][0] += DP[i][j + 1][0];
        if (i < n - 1 && j < m - 1) DP[i][j][0] -= DP[i + 1][j + 1][0];
        DP[i][j][0] %= 1000000007;
        DP[i][j][0] += 1000000007;
        DP[i][j][0] %= 1000000007;
        rocks = CALC(i + 1, j, n - 1, j);
        COUNT = CALCDP(i + 1, j, n - 1 - rocks, j, 0);
        DP[i][j][1] += COUNT;
        if (i < n - 1) DP[i][j][1] += DP[i + 1][j][1];
        if (j < m - 1) DP[i][j][1] += DP[i][j + 1][1];
        if (i < n - 1 && j < m - 1) DP[i][j][1] -= DP[i + 1][j + 1][1];
        DP[i][j][1] %= 1000000007;
        DP[i][j][1] += 1000000007;
        DP[i][j][1] %= 1000000007;
      }
    }
  }
  long long int count_zero =
      getDP(0, 0, 0) - getDP(0, 1, 0) - getDP(1, 0, 0) + getDP(1, 1, 0);
  count_zero %= 1000000007;
  count_zero += 1000000007;
  count_zero %= 1000000007;
  long long int count_ones =
      getDP(0, 0, 1) - getDP(0, 1, 1) - getDP(1, 0, 1) + getDP(1, 1, 1);
  count_ones %= 1000000007;
  count_ones += 1000000007;
  count_ones %= 1000000007;
  cout << (count_zero + count_ones) % 1000000007 << endl;
  return 0;
}
