#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<string> brd;
long long mod = 1000000007;
vector<vector<long long> > mdp1(3000, vector<long long>(3000, -1)),
    mdp2(3000, vector<long long>(3000, -1));
long long dp1(int a, int b) {
  if (a == 0 && b == 1) return 1;
  if (a < 0 || b < 1) return 0;
  if (brd[a][b] != '.') return 0;
  if (mdp1[a][b] != -1) return mdp1[a][b];
  long long ans = 0;
  if (a > 0 && brd[a - 1][b] == '.') ans += dp1(a - 1, b);
  if (b > 0 && brd[a][b - 1] == '.') ans += dp1(a, b - 1);
  return mdp1[a][b] = ans % mod;
}
long long dp2(int a, int b) {
  if (a == 1 && b == 0) return 1;
  if (a < 1 || b < 0) return 0;
  if (brd[a][b] != '.') return 0;
  if (mdp2[a][b] != -1) return mdp2[a][b];
  long long ans = 0;
  if (a > 0 && brd[a - 1][b] == '.') ans += dp2(a - 1, b);
  if (b > 0 && brd[a][b - 1] == '.') ans += dp2(a, b - 1);
  return mdp2[a][b] = ans % mod;
}
int main() {
  cin.sync_with_stdio(0);
  cin >> n >> m;
  brd.resize(n);
  for (int i = 0; i < n; ++i) cin >> brd[i];
  long long ans = 0;
  ans = dp2(n - 1, m - 2) * dp1(n - 2, m - 1);
  ans %= mod;
  ans -= (dp2(n - 2, m - 1) * dp1(n - 1, m - 2)) % mod;
  ans += mod;
  cout << ans % mod << endl;
  return 0;
}
