#include <bits/stdc++.h>
using namespace std;
const long long mode = 1e9 + 7;
char a[3030][3030];
int n, m;
long long f[3030][3030];
long long find(int x1, int y1, int x2, int y2) {
  memset(f, 0, sizeof(f));
  f[x1][y1] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      if (a[i][j] != '#') {
        if (i == x1 && j == y1) continue;
        f[i][j] = f[i - 1][j] + f[i][j - 1];
        if (f[i][j] >= mode) f[i][j] -= mode;
        if (i == x2 && j == y2) return f[i][j];
      }
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) scanf("%s", a[i] + 1);
  if (a[n][m - 1] == '#' || a[n - 1][m] == '#' || a[n][m] == '#' ||
      a[1][2] == '#' || a[2][1] == '#') {
    printf("0");
    return 0;
  }
  long long v = find(1, 2, n - 1, m) * find(2, 1, n, m - 1) % mode;
  v -= find(1, 2, n, m - 1) * find(2, 1, n - 1, m) % mode;
  cout << (v + mode) % mode;
}
