#pragma region template
// clang-format off
#ifdef ONLINE_JUDGE
  #define here
  #define com(msg)
  #define watch(...)
  #define watchVec(vec)
  #define local(x)
  #define alter(x,y) y
#else
  #define here cerr<<__func__<<"/"<<__LINE__<<": reached\n"
  #define com(msg) cerr<<"{ "<<msg<< " }\n"
  #define watch(...) observe(#__VA_ARGS__,__VA_ARGS__)
  #define watchVec(vec) do{cerr<<#vec<<": ";printv(#vec,vec);}while(0)
  #define local(x) do{x}while(0)
  #define alter(x,y) x
#endif

#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rng(i,f,t,s) for(int i=(f);i<(t);i+=(s))
#define erng(i,f,t,s) for(int i=(f);i<=(t);i+=(s))
#define yes(n) cout<<((n)?YES:NO)<<"\n"
#define Sort(v) sort((v).begin(),(v).end())
#define rSort(v) sort((v).rbegin(),(v).rend())
#define Rev(v) reverse((v).begin(),(v).end())
#define Unique(v) (v).erase(unique((v).begin(),(v).end()),(v).end())
#define inarea(p,a,b) (0<=(p.first)&&0<=(p.second)&&(p.first)<(a)&&(p.second)<(b))
#define in_area(y,x,a,b) (0<=(y)&&0<=(x)&&(y)<(a)&&(x)<(b))
#define in_range(x,a,b) ((a)<=(x)&&(x)<(b))

using namespace std;
using ll    = long long;
using ld    = long double;
using pt    = pair<int, int>;
using ull   = unsigned long long;
using str   = string;
using vbl   = vector<bool>;
using dqbl  = deque<bool>;
using vint  = vector<int>;
using vll   = vector<long long>;
using vdb   = vector<double>;
using vld   = vector<long double>;
using vpt   = vector<pair<int, int>>;
using vstr  = vector<string>;
using vvdb  = vector<vector<double>>;
using vvbl  = vector<vector<bool>>;
using vdqbl = vector<deque<bool>>;
using vvint = vector<vector<int>>;
using vvll  = vector<vector<long long>>;
using Int   = boost::multiprecision::cpp_int;

constexpr int       INF   = 1e9;
constexpr long long LINF  = 1e18;
constexpr double    EPS   = 1e-9;
constexpr long long MOD   = 1000000007;
constexpr int       dy[]  = {1,0,-1,0,1,1,-1,-1};
constexpr int       dx[]  = {0,1,0,-1,-1,1,1,-1};
constexpr pt        dv[]  = { {1,0},{0,1},{-1,0},{0,-1},{1,-1},{1,1},{-1,1},{-1,-1} };

template<class T, class F> constexpr T bin_search(T ok, T ng, const F &f) {
  assert(f(ok) && !f(ng));
  if (ok < ng) {
    T mid;
    while (ng - ok > 1) {
      mid = ok + ((ng - ok) >> 1);
      (f(mid) ? ok : ng) = mid;
    }
  } else if (ok > ng) {
    T mid;
    while (ok - ng > 1) {
      mid = ng + ((ok - ng) >> 1);
      (f(mid) ? ok : ng) = mid;
    }
  }
  return ok;
}

// --- mod library --- //
template <class T> constexpr long long modpow(long long base, T exponent, long long mod = MOD) {
  long long ret = 1;

  while (exponent > 0) {
    if (exponent & 1) {
      ret *= base;
      ret %= mod;
    }
    base *= base;
    base %= mod;
    exponent >>= 1;
  }

  return ret;
}

template <class T = long long> constexpr T modinv(long long n, int mod = MOD) {
  int a = n, b = mod, u = 1, v = 0, t = 0;
  while (b > 0) {
    t = a / b;
    swap(a -= t * b, b);
    swap(u -= t * v, v);
  }
  return (T) u;
}

class mint {
  public:
  template<class T = int> constexpr mint(T v = 0) : val(v) { this->clamp(); }

  #define MINT_PREFIX_OP(o) \
  constexpr mint& operator o () { (this->val) o; this->clamp(); return *this; }
  MINT_PREFIX_OP(++)
  MINT_PREFIX_OP(--)
  #undef MINT_PREFIX_OP

  #define MINT_POSTFIX_OP(o) \
  constexpr mint operator o (int) { mint ret = *this; o (*this); return ret; }
  MINT_POSTFIX_OP(++)
  MINT_POSTFIX_OP(--)
  #undef MINT_POSTFIX_OP

  #define MINT_UNARY_OP(o) \
  constexpr mint operator o () const { return mint( o (this->val) ); }
  MINT_UNARY_OP(+)
  MINT_UNARY_OP(-)
  MINT_UNARY_OP(~)
  #undef MINT_UNARY_OP

  constexpr bool operator! () const { return !(this->val); }

  #define MINT_BOOLEAN_OP(o) \
  constexpr bool operator o (mint rhs) const { return (this->val o rhs.val); }
  MINT_BOOLEAN_OP(==)
  MINT_BOOLEAN_OP(!=)
  MINT_BOOLEAN_OP(<)
  MINT_BOOLEAN_OP(<=)
  MINT_BOOLEAN_OP(>)
  MINT_BOOLEAN_OP(>=)
  MINT_BOOLEAN_OP(&&)
  MINT_BOOLEAN_OP(||)
  #undef MINT_BOOLEAN_OP

  #define MINT_TEMP_BOOLEAN_OP(o) \
  template<class T> constexpr bool operator o (T rhs) const { return (this->val o rhs); }
  MINT_TEMP_BOOLEAN_OP(==)
  MINT_TEMP_BOOLEAN_OP(!=)
  MINT_TEMP_BOOLEAN_OP(<)
  MINT_TEMP_BOOLEAN_OP(<=)
  MINT_TEMP_BOOLEAN_OP(>)
  MINT_TEMP_BOOLEAN_OP(>=)
  MINT_TEMP_BOOLEAN_OP(&&)
  MINT_TEMP_BOOLEAN_OP(||)
  #undef MINT_TEMP_BOOLEAN_OP

  #define MINT_COMPOUND_OP(o) \
  [[maybe_unused]] constexpr mint& operator o##= (mint rhs) { this->val = clamp_ll((long long) this->val o rhs.val); return *this; }
  MINT_COMPOUND_OP(+)
  MINT_COMPOUND_OP(-)
  MINT_COMPOUND_OP(*)
  MINT_COMPOUND_OP(%)
  MINT_COMPOUND_OP(&)
  MINT_COMPOUND_OP(|)
  MINT_COMPOUND_OP(^)
  MINT_COMPOUND_OP(<<)
  MINT_COMPOUND_OP(>>)
  #undef MINT_COMPOUND_OP

  #define MINT_TEMP_COMPOUND_OP(o) \
  template<class T> [[maybe_unused]] constexpr mint& operator o##= (T rhs) { this->val = (*this o mint(rhs)); this->clamp(); return *this; }
  MINT_TEMP_COMPOUND_OP(+)
  MINT_TEMP_COMPOUND_OP(-)
  MINT_TEMP_COMPOUND_OP(*)
  MINT_TEMP_COMPOUND_OP(%)
  MINT_TEMP_COMPOUND_OP(&)
  MINT_TEMP_COMPOUND_OP(|)
  MINT_TEMP_COMPOUND_OP(^)
  MINT_TEMP_COMPOUND_OP(<<)
  MINT_TEMP_COMPOUND_OP(>>)
  #undef MINT_TEMP_COMPOUND_OP

  template<class T> [[maybe_unused]] constexpr mint& operator/=(T divided_by) {
    assert(divided_by != 0);
    *this *= modinv(divided_by);
    return *this;
  }

  #define MINT_OP(o) \
  constexpr mint operator o (mint rhs) const { return mint(*this) o##= rhs; }
  MINT_OP(+)
  MINT_OP(-)
  MINT_OP(*)
  MINT_OP(/)
  MINT_OP(%)
  MINT_OP(&)
  MINT_OP(|)
  MINT_OP(^)
  MINT_OP(<<)
  MINT_OP(>>)
  #undef MINT_OP

  #define MINT_TEMP_OP(o) \
  template<class T> constexpr mint operator o (T rhs) const { return *this o mint(rhs); }
  MINT_TEMP_OP(+)
  MINT_TEMP_OP(-)
  MINT_TEMP_OP(*)
  MINT_TEMP_OP(%)
  MINT_TEMP_OP(&)
  MINT_TEMP_OP(|)
  MINT_TEMP_OP(^)
  MINT_TEMP_OP(<<)
  MINT_TEMP_OP(>>)
  #undef MINT_TEMP_OP

  #define MINT_CAST_OP(t) \
  constexpr operator t () const { return static_cast<t>(this->val); }
  MINT_CAST_OP(bool)
  MINT_CAST_OP(char)
  MINT_CAST_OP(signed char)
  MINT_CAST_OP(unsigned char)
  MINT_CAST_OP(short int)
  MINT_CAST_OP(unsigned short int)
  MINT_CAST_OP(int)
  MINT_CAST_OP(unsigned int)
  MINT_CAST_OP(long int)
  MINT_CAST_OP(unsigned long int)
  MINT_CAST_OP(long long int)
  MINT_CAST_OP(unsigned long long int)
  MINT_CAST_OP(float)
  MINT_CAST_OP(double)
  MINT_CAST_OP(long double)
  #undef MINT_CAST_OP
  operator boost::multiprecision::cpp_int() const { return static_cast<boost::multiprecision::cpp_int>(this->val); }

  constexpr mint inverse() { return modinv<mint>(this->val); }

  friend istream& operator>> (istream&, mint&);
  friend ostream& operator<< (ostream&, mint);

  private:
  int val;

  constexpr void clamp() {
    if (0 <= (this->val) && (this->val) < MOD) return;
    if (MOD <= (this->val) && (this->val) < (MOD << 1)) {
      (this->val) -= MOD;
      return;
    }
    if (-MOD <= (this->val) && (this->val) < 0) {
      (this->val) += MOD;
      return;
    }

    if (0 <= (this->val))
      (this->val) -= MOD * bin_search(0LL, MOD, [&](long long x) -> bool { return (this->val) >= MOD * x; });
    else
      (this->val) -= MOD * bin_search(-MOD, 0LL, [&](long long x) -> bool { return (this->val) >= MOD * x; });
  }

  constexpr int clamp_ll(long long v) {
    if (0 <= v && v < MOD) return (int) v;
    if (MOD <= v && v < (MOD << 1)) {
      v -= MOD;
      return v;
    }
    if (-MOD <= v && v < 0) {
      v += MOD;
      return v;
    }

    if (0 <= v)
      v -= MOD * bin_search(0LL, MOD, [&](long long x) -> bool { return v >= MOD * x; });
    else
      v -= MOD * bin_search(-MOD, 0LL, [&](long long x) -> bool { return v >= MOD * x; });
    return v;
  }
};

template <class T> constexpr mint modpow(mint base, T exponent) {
  mint ret(1);

  while (exponent > 0) {
    if (exponent & 1) ret *= base;
    base *= base;
    exponent >>= 1;
  }

  return ret;
}

istream& operator>> (istream &is, mint& m) { return is >> m.val; }
ostream& operator<< (ostream &os, mint m)  { return os << m.val; }

// --- functions which take 1 argument --- //
template<class T> int sgn(T x){return (x>0)-(x<0);}
template<class S,class T=int> int digit(S x,T b=10){int r=1;while((x/=b)>=1)r++;return r;}
template<class T> double degToRad(T a){return a/180.0*M_PI;}
template<class T> double radToDeg(T a){return a/M_PI*180.0;}
template<class T> long long factorial(T n) {if(n==0)return 1;long long r=1;for(int i=2;i<=n;i++)r*=i;return r;}
template<class T> bool isPrime(T n){if(n<=1)return false;T i=2;while(i*i<=n){if(n%i==0&&n!=i)return false;i++;}return true;}
template<class T> map<T,T> factorize(T n){map<T,T>r;for(T i=2;i*i<=n;i++){while(n%i==0){r[i]++;n/=i;}}if(n!=1)r[n]=1;return r;}
template<class T> vector<T> divisor(T n){vector<T>r;for(T i=1;i*i<=n;i++){if(!(n%i)){r.emplace_back(i);if(i*i!=n)r.emplace_back(n/i);}}return r;}

// --- functions which take more than 1 argument --- //
template<class S,class T> [[maybe_unused]] bool chmax(S &a,T b){if(a<b){a=b;return true;}return false;}
template<class S,class T> [[maybe_unused]] bool chmin(S &a,T b){if(a>b){a=b;return true;}return false;}
template<class S,class T> bool near(S a,T b){return abs(a-b)<EPS;}
template<class S,class T> long long bpow(S m,T n){long long r=1;while(n>0){if(n&1)r*=m;m*=m;n/=2;}return r;}
template<class S,class T> typename common_type<S,T>::type min(S m,T n){return min((typename common_type<S,T>::type)m,(typename common_type<S,T>::type)n);}
template<class S,class T> typename common_type<S,T>::type max(S m,T n){return max((typename common_type<S,T>::type)m,(typename common_type<S,T>::type)n);}
template<class S,class T> long long nPr(S n,T k){if(n<k||n<0||k<0)return 0;long long r=1;for(int i=n-k+1;i<=n;i++)r*=i;return r;}
template<class S,class T> long long nCr(S n,T k){if(n<k||n<0||k<0)return 0;long long r=1;k=min(k,n-k);for(int i=n-k+1;i<=n;i++)r*=i;return r/factorial(k);}
template<class T>            void prints(T v){cout<<v<<"\n";}
template<class S,class... T> void prints(S v,T... w){cout<<v<<" ";prints(w...);}

// --- functions which take vector/deque as argument --- //
template<class T> void printd(const vector<T> &v,const string &d){for(int i=0;i<(int)v.size()-1;i++)cout<<v[i]<<d;cout<<*v.rbegin()<<"\n";}
template<class T> void printd(const vector<vector<T>> &v,const string &d){for(const auto &x:v)printD(x,d);}
template<class T> bool in(T k,const vector<T> &v)          {return find(v.begin(),v.end(),k)!=v.end();}
                  bool in(int k,const vector<long long> &v){return find(v.begin(),v.end(),k)!=v.end();}
                  bool in(long long k,const vector<int> &v){return find(v.begin(),v.end(),k)!=v.end();}
                  bool in(char k,const string &v)          {return find(v.begin(),v.end(),k)!=v.end();}
                  bool in(const char *k,const vector<string> &v)  {return find(v.begin(),v.end(),k)!=v.end();}
template<class T> double veclen(const vector<T> &v){return sqrt(reduce(v.begin(),v.end(),0.0,[](T s,T k){return s+=k*k;}));}
template<class T> T min(const vector<T> &v){return *min_element(v.begin(),v.end());}
template<class T> T max(const vector<T> &v){return *max_element(v.begin(),v.end());}
template<class T> T sum(const vector<T> &v){return reduce(v.begin(),v.end(),(T)0);}
template<class T> T gcd(const vector<T> &v){T r=v[0];for(int i=1;i<v.size();i++)r=gcd(r,v[i]);return r;}
template<class T> T lcm(const vector<T> &v){T r=v[0];for(int i=1;i<v.size();i++)r=lcm(r,v[i]);return r;}
template<class T> T vectorAdd(const T &u,const T &v)     {T r(u.size());for(int i=0;i<u.size();i++)r[i]=u[i]+v[i];return r;}
template<class T> T vectorSubtract(const T &u,const T &v){T r(u.size());for(int i=0;i<u.size();i++)r[i]=u[i]-v[i];return r;}
template<class T> T vectorMultiply(const T &u,const T &v){T r(u.size());for(int i=0;i<u.size();i++)r[i]=u[i]*v[i];return r;}
template<class T> T vectorDivide(const T &u,const T &v)  {T r(u.size());for(int i=0;i<u.size();i++)r[i]=u[i]/v[i];return r;}
template<class T> T dotProduct(const deque<bool> &u,const vector<T> &v){T r=0;for(int i=0;i<u.size();i++)if(u[i])r+=v[i];return r;}
template<class S,class T> typename common_type<S,T>::type dotProduct(const vector<S> &u,const vector<T> &v){typename common_type<S,T>::type r=0;for(int i=0;i<u.size();i++)r+=u[i]*v[i];return r;}
template<class S,class T> void sortBySecond(vector<pair<S,T>> &v){sort(v.begin(),v.end(),[](auto &L,auto &R){return (L.second==R.second)?(L.first<R.first):(L.second<R.second);});}

// --- functions which take set/map as argument --- //
template<class T> T min(const set<T> &v){return *min_element(v.begin(),v.end());}
template<class T> T max(const set<T> &v){return *max_element(v.begin(),v.end());}
template<class T> T sum(const set<T> &v){return reduce(v.begin(),v.end(),(T)0);}
template<class T> T gcd(const set<T> &v){T r=0;for(const T &x:v)r=(r==0)?x:gcd(r,x);return r;}
template<class T> T lcm(const set<T> &v){T r=0;for(const T &x:v)r=(r==0)?x:lcm(r,x);return r;}
template<class T> bool in(const T &k,const set<T> &v){return find(v.begin(),v.end(),k)!=v.end();}
template<class S,class T> pair<S,T> min(const map<S,T> &m){pair<S,T> r=*m.begin();for(const pair<S,T> &p:m)if(r.second>p.second)r=p;return r;}
template<class S,class T> pair<S,T> max(const map<S,T> &m){pair<S,T> r=*m.begin();for(const pair<S,T> &p:m)if(r.second<p.second)r=p;return r;}

// --- operators --- //
template<class T>         istream& operator>>(istream &i,vector<T> &v){cin.tie(nullptr);ios::sync_with_stdio(false);for(T &x:v)i>>x;return i;}
template<class T>         ostream& operator<<(ostream &o,vector<T> &v){for(T &x:v)o<<x<<"\n";return o;}
template<class S,class T> istream& operator>>(istream &i,pair<S,T> &p){i>>p.first>>p.second;return i;}
template<class S,class T> ostream& operator<<(ostream &o,pair<S,T> &p){o<<p.first<<" "<<p.second<<"\n";return o;}
template<class S,class T> pair<S,T> operator+(const pair<S,T> &p,const pair<S,T> &q){return pair<S,T>{p.first+q.first,p.second+q.second};}
template<class S,class T> pair<S,T> operator-(const pair<S,T> &p,const pair<S,T> &q){return pair<S,T>{p.first-q.first,p.second-q.second};}
template<class S,class T> pair<S,T> operator*(const pair<S,T> &p,const pair<S,T> &q){return pair<S,T>{p.first*q.first,p.second*q.second};}
template<class S,class T> pair<S,T> operator/(const pair<S,T> &p,const pair<S,T> &q){return pair<S,T>{p.first/q.first,p.second/q.second};}
template<class S,class T> [[maybe_unused]] pair<S,T> operator--(pair<S,T> &p){return pair<S,T>{--p.first,--p.second};}
template<class S,class T> [[maybe_unused]] pair<S,T> operator++(pair<S,T> &p){return pair<S,T>{++p.first,++p.second};}
template<class S,class T> [[maybe_unused]] pair<S,T> operator+=(pair<S,T> &p,const pair<S,T> &q){return p=p+q;}
template<class S,class T> [[maybe_unused]] pair<S,T> operator-=(pair<S,T> &p,const pair<S,T> &q){return p=p-q;}
template<class S,class T> [[maybe_unused]] pair<S,T> operator*=(pair<S,T> &p,const pair<S,T> &q){return p=p*q;}
template<class S,class T> [[maybe_unused]] pair<S,T> operator/=(pair<S,T> &p,const pair<S,T> &q){return p=p/q;}

// --- functions for debugging --- //
template<class T>            void observe(const char *n,T &&v)         {cerr<<n<<": "<<v<<"\n";}
template<class S,class... T> void observe(const char *n,S &&v,T&&... w){const char *c=strchr(n+1,',');cerr.write(n,c-n)<<": "<<v<<" |";observe(c+1,w...);}
template<class T> void printv([[maybe_unused]] const char *n, const vector<T> &v){cerr<<"[ ";for(const T &x:v)cerr<<x<<" ";cerr<<"]\n";}
template<class T> void printv([[maybe_unused]] const char *n, const deque<T> &v) {cerr<<"[ ";for(const T &x:v)cerr<<x<<" ";cerr<<"]\n";}
template<class T> void printv([[maybe_unused]] const char *n, const set<T> &v)   {cerr<<"[ ";for(const T &x:v)cerr<<x<<" ";cerr<<"]\n";}
template<class P> void printv([[maybe_unused]] const char *n, const P &p){cerr<<"{ "<<p.first<<" "<<p.second<<" } ";}
template<class T> void printv(const char *n, const vector<vector<T>> &v){bool f=0;for(const vector<T> &x:v){if(f)cerr<<string(strlen(n)+2,' ');f=1;printv<T>("",x);}}
template<class T> void printv(const char *n, const vector<deque<T>> &v) {bool f=0;for(const deque<T> &x:v){if(f)cerr<<string(strlen(n)+2,' ');f=1;printv<T>("",x);}}
template<class S,class T> void printv([[maybe_unused]] const char *n, const map<S,T> &m) {cerr<<"[ ";for(const pair<S,T> &p:m)cerr<<"{ "<<p.first<<", "<<p.second<<" } ";cerr<<"]\n";}
template<class S,class T> void printv([[maybe_unused]] const char *n, const vector<pair<S,T>> &v){cerr<<"[ ";for(const pair<S,T> &p:v)printv<pair<S,T>>("",p);cerr<<"]\n";}
template<class S,class T> void printv([[maybe_unused]] const char *n, const deque<pair<S,T>> &v){cerr<<"[ ";for(const pair<S,T> &p:v)printv<pair<S,T>>("",p);cerr<<"]\n";}
// clang-format on
#pragma endregion
// mod

void solve(int H, int W, vector<string> a) {
  vector<vector<mint>> dp(H, vector<mint>(W, 0));
  dp[0][0] = 1;

  rep(i, H) {
    rep(j, W) {
      if (a[i][j] == '#') continue;
      if (i - 1 >= 0) dp[i][j] += dp[i - 1][j];
      if (j - 1 >= 0) dp[i][j] += dp[i][j - 1];
    }
  }

  cout << dp[H - 1][W - 1] << "\n";
}

// clang-format off
int main() {
  // nCr_mod_init();
  #pragma GCC diagnostic push
  #pragma GCC diagnostic ignored "-Wunused-result"
  int H;
  scanf("%d",&H);
  int W;
  scanf("%d",&W);
  vector<string> a(H);
  for(int i = 0 ; i < H ; i++){
    cin >> a[i];
  }
  #pragma GCC diagnostic pop
  solve(H, W, move(a));
  exit(EXIT_SUCCESS);
}


Measured memory_bytes: 9520