//__________________Do_What_You_want___//
//__________I_DO_What_I_Want___________________________//

#include<bits/stdc++.h>
#include <map>
#include "ext/pb_ds/assoc_container.hpp" 
#include "ext/pb_ds/tree_policy.hpp"
#include "ext/pb_ds/detail/standard_policies.hpp"
using namespace __gnu_pbds;
using namespace std ;

//----------------------------------INDEX_TREE-----------------------------------------//
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> multiordered_set;

//-------------------------------------------------------------------------------------//
#define pb push_back 
#define eb emplace_back
#define F first 
#define mk make_pair
#define S second
#define siz(v) (int)v.size() 
#define all(v) (v).begin(),(v).end() 
#define endl '\n'
#define int long long
const int mod = 1000000007 ;
//------------------------------FUNCTIONS----------------------------------------------//
int powermod(int a,int b){int res=1;while(b){if(b&1)(res*=a)%=mod;b/=2;(a*=a)%=mod;}return res%mod;}

int power(int a,int b){int res=1;a%=mod;while(b>0){if(b&1)res*=a;b/=2;a*=a;}return res;}

bool isprime(int n){for(int i=2;i*i<=n;i++){if(n%i==0)return false;}return true;}

vector<int> sieve(int n){vector<int> prime ;vector<int> vis(n+1,false);
for(int i=2;i*i<=n;i++){if(vis[i] == false){for(int j=i*i;j<=n;j+=i){vis[j]=true;}}}
for(int i=2;i<=n;i++){if(vis[i]==false){prime.push_back(i);}}return prime;}

long double to_deg(long double x) { return x * 180 / acos(-1); }
int logi(int x){int p = 0 ;while(x>1){p++;x/=2;}return p ;}

int ncr(int n,int r){int p = 1 , l = 1 ;if(n-r < r) r = n-r ;
    while(r){p *= n ;l *= r ;int g = __gcd(p,l) ;p /= g ;l /= g ;n--;r--;}
    return p ;
}

vector<int>_x{0,0,0,1,1,1,-1,-1,-1} ;
vector<int>_y{0,1,-1,0,1,-1,0,1,-1} ;

int mul(int a , int b){return (a*b)%mod ;}
int add(int a , int b){return (a+b)%mod ;}

//-------------------------------------------------------------------------------------//
set<int> adj[100010] ;
signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);cout.tie(NULL);
    //--------------------------------GETLINE------------------------------------------//
    //cin.ignore();
    //--------------------------------input/output-------------------------------------//
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);

    //----------------code-------------------------------------------------------------//
    int r , c ;
    cin >> r >> c ;

    char a[r][c] ;
    vector<vector<int>> ways(r,vector<int>(c)) ;

    for(int i=0;i<r;i++){
        for(int j=0;j<c;j++){
            cin>>a[i][j] ;
        }
    }
    for(int i=0;i<c;i++){
        if(a[0][i] == '#') break;
        ways[0][i] = 1 ;
    }
    for(int i=0;i<r;i++){
        if(a[i][0] == '#') break;
        ways[i][0] = 1 ;
    }

    for(int i=1;i<r;i++){
        for(int j=1;j<c;j++){
            if(a[i][j] == '.' ) ways[i][j] = add(ways[i-1][j] , ways[i][j-1]) ;
            //cout<<ways[i][j]<<" ";
        }
        //cout<<endl;
    }
    cout<<ways[r-1][c-1]<<endl;
}


Measured memory_bytes: 16660