//#pragma GCC optimize("Og,no-stack-protector,unroll-loops,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace boost::multiprecision;
using namespace __gnu_pbds;
template <typename T>
using os = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long  ll;
typedef double ld;
#define ios ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define pii pair<ll,ll>
#define vi  vector<ll>
#define vii vector<pii >
#define mi  map<ll,ll>
#define umi unordered_map<ll,ll,custom_hash>
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define make make_pair
#define ff first
#define ss second
#define osl os<ll>
#define ospii os<pair<ll,ll> >
#define endl "\n"
#define n_l '\n'
#define dbg(...) cout << "[" << #__VA_ARGS__ << "]: "; cout << to_string(__VA_ARGS__) << endl
template <typename T, size_t N> int SIZE(const T (&t)[N]){ return N; } template<typename T> int SIZE(const T &t){ return t.size(); } string to_string(const string s, int x1=0, int x2=1e9){ return '"' + ((x1 < s.size()) ? s.substr(x1, x2-x1+1) : "") + '"'; } string to_string(const char* s) { return to_string((string) s); } string to_string(const bool b) { return (b ? "true" : "false"); } string to_string(const char c){ return string({c}); } template<size_t N> string to_string(const bitset<N> &b, int x1=0, int x2=1e9){ string t = ""; for(int __iii__ = min(x1,SIZE(b)),  __jjj__ = min(x2, SIZE(b)-1); __iii__ <= __jjj__; ++__iii__){ t += b[__iii__] + '0'; } return '"' + t + '"'; } template <typename A, typename... C> string to_string(const A (&v), int x1=0, int x2=1e9, C... coords); int l_v_l_v_l = 0, t_a_b_s = 0; template <typename A, typename B> string to_string(const pair<A, B> &p) { l_v_l_v_l++; string res = "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; l_v_l_v_l--; return res; } template <typename A, typename... C> string to_string(const A (&v), int x1, int x2, C... coords) { int rnk = rank<A>::value; string tab(t_a_b_s, ' '); string res = ""; bool first = true; if(l_v_l_v_l == 0) res += n_l; res += tab + "["; x1 = min(x1, SIZE(v)), x2 = min(x2, SIZE(v)); auto l = begin(v); advance(l, x1); auto r = l; advance(r, (x2-x1) + (x2 < SIZE(v))); for (auto e = l; e != r; e = next(e)) { if (!first) { res += ", "; } first = false; l_v_l_v_l++; if(e != l){ if(rnk > 1) { res += n_l; t_a_b_s = l_v_l_v_l; }; } else{ t_a_b_s = 0; } res += to_string(*e, coords...); l_v_l_v_l--; } res += "]"; if(l_v_l_v_l == 0) res += n_l; return res; } void dbgm(){;} template<typename Heads, typename... Tails> void dbgm(Heads H, Tails... T){ cout << to_string(H) << " | "; dbgm(T...); }
#define dbgm(...) cout << "[" << #__VA_ARGS__ << "]: "; dbgm(__VA_ARGS__); cout << endl
/*expanded version*/
/*
 template <typename T, size_t N>
 int SIZE(const T (&t)[N]){
     return N;
 }

 template<typename T>
 int SIZE(const T &t){
     return t.size();
 }

 string to_string(const string s, int x1=0, int x2=1e9){
     return '"' + ((x1 < s.size()) ? s.substr(x1, x2-x1+1) : "") + '"';
 }

 string to_string(const char* s) {
     return to_string((string) s);
 }

 string to_string(const bool b) {
     return (b ? "true" : "false");
 }

 string to_string(const char c){
     return string({c});
 }

 template<size_t N>
 string to_string(const bitset<N> &b, int x1=0, int x2=1e9){
     string t = "";
     for(int __iii__ = min(x1,SIZE(b)),  __jjj__ = min(x2, SIZE(b)-1); __iii__ <= __jjj__; ++__iii__){
       t += b[__iii__] + '0';
     }
     return '"' + t + '"';
 }

 template <typename A, typename... C>
 string to_string(const A (&v), int x1=0, int x2=1e9, C... coords);

 int l_v_l_v_l = 0, t_a_b_s = 0;

 template <typename A, typename B>
 string to_string(const pair<A, B> &p) {
     l_v_l_v_l++;
     string res = "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
     l_v_l_v_l--;
     return res;
 }

 template <typename A, typename... C>
 string to_string(const A (&v), int x1, int x2, C... coords) {

     int rnk = rank<A>::value;
     string tab(t_a_b_s, ' ');

     string res = "";
     bool first = true;

     if(l_v_l_v_l == 0) res += n_l;
     res += tab + "[";

     x1 = min(x1, SIZE(v)), x2 = min(x2, SIZE(v));
     auto l = begin(v);
     advance(l, x1);
     auto r = l;
     advance(r, (x2-x1) + (x2 < SIZE(v)));

     for (auto e = l; e != r; e = next(e)) {
         if (!first) {
             res += ", ";
         }
         first = false;

         l_v_l_v_l++;
         if(e != l){
             if(rnk > 1) {
                 res += n_l;
                 t_a_b_s = l_v_l_v_l;
             };
         }
         else{
             t_a_b_s = 0;
         }

         res += to_string(*e, coords...);
         l_v_l_v_l--;
     }
     res += "]";
     if(l_v_l_v_l == 0) res += n_l;
     return res;
 }

 void dbgm(){;}
 template<typename Heads, typename... Tails>
 void dbgm(Heads H, Tails... T){
     cout << to_string(H) << " | ";
     dbgm(T...);
}
#define dbgm(...) cout << "[" << #__VA_ARGS__ << "]: "; dbgm(__VA_ARGS__); cout << endl;

//*/
/*end of expanded version*/
clock_t time_p=clock();
void Auriel()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {

        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
template <typename  R>
void println(R r){
    for(auto i:r)
        cout<<i<<" ";
    cout<<endl;

}
template <typename  R>
void print(R r){
    int e=0;
    for(auto i:r)
        cout<<i<<endl;
}
template <typename R>
void scnln(R &r){
    for(auto &i:r)
        cin>>i;
}
ll st[200005]={0},ft[200005]={0},parent[200005],tt=0,level[100005]={0},fans=0;
ll binexp(ll a,ll b,ll m)
{
    ll ans=1;
    while(b)
    {
        if(b&1)
            ans=(ans*a)%m;
        b/=2;
        a=(a*a)%m;
    }
    return ans;
}
//ll dp[100001];
void dfs(vi graph[],ll start,ll *visit,vi& seq){
    visit[start]=1;
    seq.pb(start);
    // level[0]=0;
    st[start]=tt;
    tt++;
    for(auto child:graph[start]){

        if(!visit[child]){
            parent[child]=start;
            dfs(graph, child, visit,seq);
        }

    }
    ft[start]=tt;

}
void dijikstra(vector<pair<ll,ll> > graph[],ll start,ll *visit,ll *cost){
    cost[start]=0;
    // visit[start]=1;
    multiset<pair<ll,ll> > ms;
    ms.insert({0,start});
    while(ms.size()!=0){
        pair<ll,ll> p=*ms.begin();
        ms.erase(ms.begin());
        ll x=p.second; //ll w=p.second;
        if(visit[x]==1)
            continue;
        visit[x]=1;
        for(int i=0;i<graph[x].size();i++){
            ll e=graph[x][i].first; ll w=graph[x][i].second;
            if(cost[x]+w<cost[e]) {
                cost[e] = w + cost[x];
                ms.insert({cost[e],e});

            }

        }
    }
}
int bfs1(multiset<ll> graph[],ll *visit,ll *level,vi &v){
    multiset<ll> q;
    ll start=1;
    q.insert(start);
    level[start]=0;
    visit[start]=1;
    while(q.size()!=0){
        ll p=*q.begin();
        q.erase(q.begin());
        v.pb(p);
        for(auto it=graph[p].begin();it!=graph[p].end();it++){
            level[(*it)]=min(level[*it],level[p]+1);
            if(visit[(*it)]!=1){
                q.insert((*it));
                visit[(*it)]=1;


            }
        }

    }
}
int main() {
    ios
    ll h,w; cin>>h>>w; char mat[h][w]; ll dp[h][w];
    rep(i,0,h){
        rep(j,0,w) {
            cin >> mat[i][j];
            dp[i][j] = 0;
        }
    }
    dp[0][0]=1;
    ll m1=ll(1e9+7);
    rep(i,0,h){
        rep(j,0,w){
            if(mat[i][j]=='#') dp[i][j]=0;
            else {
                dp[i][j] = (((j - 1 >= 0) * (mat[i][j - 1] != '#') * dp[i][j - 1])%m1 +
                        ((i - 1 >= 0) * (mat[i - 1][j] != '#') * dp[i - 1][j])%m1)%m1;
            }
            dp[0][0]=1;
            //dbgm(i,j,dp[i][j]);
        }
    }
    cout<<dp[h-1][w-1];

    Auriel();
}














Measured memory_bytes: 9088