#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int MAXM = 3005;
char val[MAXM][MAXM];
long long dp[MAXM][MAXM];
int n, m;
void cal() {
  memset(dp, 0, sizeof(dp));
  dp[0][1] = 1;
  for (int i = 1; i < n; i++) {
    if (val[i][1] == '.' && val[i - 1][1] == '.') dp[i][1] = dp[i - 1][1];
  }
  for (int j = 2; j < m; j++) {
    if (val[0][j] == '.' && val[0][j - 1] == '.') dp[0][j] = dp[0][j - 1];
  }
  for (int i = 1; i < n; i++) {
    for (int j = 2; j < m; j++) {
      if (val[i][j] == '.') dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % MOD;
    }
  }
  long long t1 = dp[n - 2][m - 1], p1 = dp[n - 1][m - 2];
  memset(dp, 0, sizeof(dp));
  dp[1][0] = 1;
  for (int i = 2; i < n; i++) {
    if (val[i][0] == '.' && val[i - 1][0] == '.') dp[i][0] = dp[i - 1][0];
  }
  for (int j = 1; j < m; j++) {
    if (val[1][j] == '.' && val[1][j - 1] == '.') dp[1][j] = dp[1][j - 1];
  }
  for (int i = 2; i < n; i++) {
    for (int j = 1; j < m; j++) {
      if (val[i][j] == '.') dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % MOD;
    }
  }
  long long t2 = dp[n - 1][m - 2], p2 = dp[n - 2][m - 1];
  int res = ((t1 * t2) % MOD - (p1 * p2) % MOD + MOD) % MOD;
  printf("%d\n", res);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%s", val[i]);
  if (val[1][0] == '#' || val[0][1] == '#' || val[n - 2][m - 1] == '#' ||
      val[n - 1][m - 2] == '#') {
    puts("0");
    return 0;
  }
  cal();
  return 0;
}
