#include <bits/stdc++.h>
using namespace std;
long long n, m;
long long f1[3005][3005];
long long f2[3005][3005];
char a[3005][3005];
bool check[3005][3005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> a[i][j];
    }
  }
  if (a[1][2] == '.') f1[1][2] = 1;
  if (a[2][1] == '.') f2[2][1] = 1;
  if ((a[1][2] == '#' and a[2][1] == '#') or
      (a[n - 1][m] == '#' and a[n][m - 1] == '#'))
    return cout << 0, 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (a[i][j] == '.') {
        f1[i][j] += ((f1[i - 1][j] + f1[i][j - 1]) % 1000000007);
        f2[i][j] += ((f2[i - 1][j] + f2[i][j - 1]) % 1000000007);
      }
    }
  }
  long long ans1 = (f1[n - 1][m] * f2[n][m - 1]) % 1000000007;
  long long ans2 = (f2[n - 1][m] * f1[n][m - 1]) % 1000000007;
  cout << (ans1 - ans2 + 1000000007) % 1000000007;
  return 0;
}
