#include <bits/stdc++.h>
template <int mod = (int)1e9 + 7>
struct ModInt {
  long long v;
  ModInt() : v(0) {}
  template <typename T>
  ModInt(T v) : v(v % mod) {}
  ModInt operator+(const ModInt &rhs) const { return (v + rhs.v) % mod; }
  template <typename T>
  ModInt operator+(const T &rhs) const {
    return (v + rhs) % mod;
  }
  template <typename T>
  void operator+=(const T &rhs) {
    *this = *this + rhs;
  }
  ModInt operator-(const ModInt &rhs) const { return (v - rhs.v) % mod; }
  template <typename T>
  ModInt operator-(const T &rhs) const {
    return (v - rhs) % mod;
  }
  template <typename T>
  void operator-=(const T &rhs) {
    *this = *this - rhs;
  }
  ModInt operator*(const ModInt &rhs) const { return (v * rhs.v) % mod; }
  template <typename T>
  ModInt operator*(const T &rhs) const {
    return (v * rhs) % mod;
  }
  template <typename T>
  void operator*=(const T &rhs) {
    *this = *this * rhs;
  }
  template <typename T>
  ModInt operator/(const T &rhs) const {
    return (*this) * static_cast<ModInt>(rhs).pow(mod - 2);
  }
  template <typename T>
  void operator/=(const T &rhs) {
    *this = *this / rhs;
  }
  template <typename T>
  ModInt pow(T rhs) const {
    long long mul = v;
    ModInt res = 1;
    while (rhs) {
      if (rhs & 1) {
        res.v *= mul;
        res.v %= mod;
      }
      mul *= mul;
      mul %= mod;
      rhs /= 2;
    }
    return res;
  }
  ModInt inverse() const {
    int v = (this->v + mod) % mod;
    int y = 0, x = 1;
    int m = mod;
    while (v > 1) {
      int q = v / m;
      int t = m;
      m = v % m;
      v = t;
      t = y;
      y = x - q * y;
      x = t;
    }
    if (x < 0) {
      x += mod;
    }
    return x;
  }
  template <typename T>
  operator T() {
    return (v + mod) % mod;
  }
};
template <class T = int>
struct BinaryIndexedTree {
  int size;
  int logSize;
  std::vector<T> tree;
  BinaryIndexedTree(int size)
      : size(size),
        logSize(sizeof(T) * 8 - __builtin_clz(size) - 1),
        tree(size + 1) {}
  void add(int index, T value) {
    assert(index >= 1 && index <= size);
    while (index <= size) {
      tree[index] += value;
      index += index & (-index);
    }
  }
  T getSum(int index) {
    assert(index <= size);
    T sum = T();
    while (index > 0) {
      sum += tree[index];
      index -= index & (-index);
    }
    return sum;
  }
  T getSum(int l, int r) { return getSum(r) - getSum(l - 1); }
  int lowerBound(T value) {
    T sum = T();
    int pos = 0;
    for (int i = logSize; i >= 0; i--) {
      if (pos + (1 << i) < size && sum + tree[pos + (1 << i)] < value) {
        sum += tree[pos + (1 << i)];
        pos += (1 << i);
      }
    }
    return pos + 1;
  }
};
struct State {
  int x, y;
  int dir, pushes;
  bool operator<(const State &s) const {
    if (x != s.x) return x < s.x;
    if (y != s.y) return y < s.y;
    if (dir != s.dir) return dir < s.dir;
    return pushes < s.pushes;
  }
};
const int MOD = 1e9 + 7;
int h, w;
char map[2005][2005];
int times[2][2005][2005] = {};
long long count[2][2005][2005] = {};
BinaryIndexedTree<ModInt<MOD> > *bit[2][2005];
int main() {
  scanf("%d %d", &h, &w);
  for (int i = 0; i < h; i++) {
    scanf("%s", map[i]);
  }
  for (int i = 0; i < 2005; i++) {
    bit[0][i] = new BinaryIndexedTree<ModInt<MOD> >(2005);
    bit[1][i] = new BinaryIndexedTree<ModInt<MOD> >(2005);
  }
  for (int y = 0; y < h; y++) {
    int t = 0;
    for (int x = w - 1; x >= 0; x--) {
      times[0][y][x] = t;
      if (map[y][x] == '.') {
        t++;
      }
    }
  }
  for (int x = 0; x < w; x++) {
    int t = 0;
    for (int y = h - 1; y >= 0; y--) {
      times[1][y][x] = t;
      if (map[y][x] == '.') {
        t++;
      }
    }
  }
  if (w == 1 && h == 1) {
    if (map[0][0] == '.') {
      printf("1\n");
    } else {
      printf("0\n");
    }
    return 0;
  }
  bit[0][1]->add(1, 1);
  bit[0][1]->add(2, -1);
  bit[1][1]->add(1, 1);
  bit[1][1]->add(2, -1);
  for (int y = 0; y < h; y++) {
    for (int x = 0; x < w; x++) {
      int t = times[0][y][x];
      if (t > 0) {
        ModInt<MOD> c = bit[0][x + 1]->getSum(y + 1);
        bit[1][y + 1]->add(x + 2, c);
        bit[1][y + 1]->add(x + t + 2, c * -1);
      }
      t = times[1][y][x];
      if (t > 0) {
        ModInt<MOD> c = bit[1][y + 1]->getSum(x + 1);
        bit[0][x + 1]->add(y + 2, c);
        bit[0][x + 1]->add(y + t + 2, c * -1);
      }
    }
  }
  ModInt<MOD> ans = bit[0][w - 1 + 1]->getSum(h - 1 + 1) +
                    bit[1][h - 1 + 1]->getSum(w - 1 + 1);
  printf("%d\n", (int)ans);
  return 0;
}
