#include <bits/stdc++.h>
using namespace std;
const int NMAX = 3100, MMAX = 3100;
long long MOD = 1000000007ll;
int N, M;
long long f[NMAX][MMAX], result[3][3] = {};
char table[NMAX][MMAX];
bool flag[NMAX][MMAX];
deque<pair<int, int> > Q;
void BFS(int x, int y) {
  pair<int, int> now;
  memset(f, 0, sizeof(f));
  memset(flag, 0, sizeof(flag));
  f[x][y] = 1;
  Q.push_back(make_pair(x, y));
  flag[x][y] = true;
  while (!Q.empty()) {
    now = Q.front();
    Q.pop_front();
    x = now.first;
    y = now.second;
    if (x + 1 <= N && table[x + 1][y] != '#') {
      f[x + 1][y] = (f[x + 1][y] + f[x][y]) % MOD;
      if (!flag[x + 1][y]) {
        Q.push_back(make_pair(x + 1, y));
        flag[x + 1][y] = true;
      }
    }
    if (y + 1 <= M && table[x][y + 1] != '#') {
      f[x][y + 1] = (f[x][y + 1] + f[x][y]) % MOD;
      if (!flag[x][y + 1]) {
        Q.push_back(make_pair(x, y + 1));
        flag[x][y + 1] = true;
      }
    }
  }
}
int main() {
  int i;
  scanf("%d %d", &N, &M);
  for (i = 1; i <= N; i += 1) scanf("%s", table[i] + 1);
  if (table[1][2] == '#' || table[2][1] == '#' || table[N - 1][M] == '#' ||
      table[N][M - 1] == '#')
    printf("0\n");
  else {
    BFS(1, 2);
    result[1][1] = f[N - 1][M];
    result[1][2] = f[N][M - 1];
    BFS(2, 1);
    result[2][1] = f[N - 1][M];
    result[2][2] = f[N][M - 1];
    printf("%I64d\n", (result[1][1] * result[2][2] % MOD -
                       result[1][2] * result[2][1] % MOD + MOD) %
                          MOD);
  }
  exit(0);
}
