#include <bits/stdc++.h>
using namespace std;
const int maxN = 3001;
long long mod = 1000000007;
int n, m;
char c[maxN][maxN];
long long d[maxN][maxN];
int stop() {
  if (c[0][1] == '#' || c[1][0] == '#' || c[n - 1][m - 2] == '#' ||
      c[n - 2][m - 1] == '#')
    return 1;
  else
    return 0;
}
long long calc(int x, int y, int N, int M) {
  memset(d, 0, sizeof(d));
  int i, j;
  d[x][y] = 1;
  for (i = x + 1; i < N; ++i)
    d[i][y] = (c[i][y] == '#') ? 0 : d[i - 1][y] % mod;
  for (i = y + 1; i < M; ++i)
    d[x][i] = (c[x][i] == '#') ? 0 : d[x][i - 1] % mod;
  for (i = x + 1; i < N; ++i) {
    for (j = y + 1; j < M; ++j) {
      if (c[i][j] == '#')
        d[i][j] = 0;
      else
        d[i][j] = (d[i - 1][j] + d[i][j - 1]) % mod;
    }
  }
  return d[N - 1][M - 1];
}
int main() {
  scanf("%d%d", &n, &m);
  int i;
  for (i = 0; i < n; ++i) scanf("%s", &c[i]);
  if (!stop()) {
    long long a1, a2, a3, a4;
    a1 = calc(0, 1, n - 1, m);
    a2 = calc(0, 1, n, m - 1);
    a3 = calc(1, 0, n - 1, m);
    a4 = calc(1, 0, n, m - 1);
    printf("%I64d\n", ((a1 * a4 - a2 * a3) % mod + mod) % mod);
  } else
    printf("0\n");
  return 0;
}
