/**
 *    author:  math2do
 *    created: 21.11.2019 19:39:18
**/

#include <bits/stdc++.h>

using namespace std;

template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "1" : "0");
}
string to_string(const char &ch) {
  return string(1, ch);
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  reverse(res.begin(), res.end());
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

template <typename T> 
string to_string(vector <vector<T>> &mat) {
  string res = "";
  char temp[32];
  int n = mat.size();
  if (n == 0) return res;
  int m = mat[0].size();
  if (m == 0) return res;
  res += "\n";
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      sprintf(temp, "%1s", to_string(mat[i][j]).c_str());
      res += string(temp);
    }
    res += "\n";
  }
  return res;
}

void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif


const int mod = (int) (1e9 + 7);

inline void add(int &a, int b) {
  a += b;
  if (a >= mod) {
    a -= mod;
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  #ifdef LOCAL
    freopen("grid_1.in", "rt", stdin);
  #endif
  int n, m;
  cin >> n >> m;
  vector <vector <char>> mat(n, vector <char>(m));
  for (int i = 0; i < n; i++) {
    string line;
    cin >> line;
    for (int j = 0; j < m; j++) {
      mat[i][j] = line[j];
    } 
  } 

  vector <vector <int>> dp(n, vector <int>(m));
  dp[0][0] = 1;
  for (int i = 1, j = 0; i < n; i++) {
    if (mat[i][j] == '#') {
      dp[i][j] = 0;
    } else {
      dp[i][j] = dp[i - 1][j];
    } 
  }
  for (int j = 1, i = 0; j < m; j++) {
    if (mat[i][j] == '#') {
      dp[i][j] = 0;
    } else {
      dp[i][j] = dp[i][j - 1];
    } 
  }

  for (int i = 1; i < n; i++) {
    for (int j = 1; j < m; j++) {
      if (mat[i][j] == '#') {
        dp[i][j] = 0;
      } else {
        add(dp[i][j], dp[i - 1][j]);
        add(dp[i][j], dp[i][j - 1]);
      }
    } 
  } 
  
  cout << dp[n - 1][m - 1] << '\n';
  return 0;
}


Measured memory_bytes: 5248