/////////////////////////////////////////////////////////////////////////////////
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$'               `$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$//  
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$'                   `$$$$$$$$$$$$$$$$$$$$$$$$$$$$//
//$$$'`$$$$$$$$$$$$$'`$$$$$$!                       !$$$$$$'`$$$$$$$$$$$$$'`$$$//
//$$$$  $$$$$$$$$$$  $$$$$$$                         $$$$$$$  $$$$$$$$$$$  $$$$//
//$$$$. `$' \' \$`  $$$$$$$!       $$        $$      !$$$$$$$  '$/ `/ `$' .$$$$//
//$$$$$. !\  i  i .$$$$$$$$       $$$$      $$$$      $$$$$$$$. i  i  /! .$$$$$//
//$$$$$$   `--`--.$$$$$$$$$        $$        $$       $$$$$$$$$.--'--'   $$$$$$//
//$$$$$$L        `$$$$$^^$$                           $$^^$$$$$'        J$$$$$$//
//$$$$$$$.   .'   ""~   $$$    $.                 .$  $$$   ~""   `.   .$$$$$$$//
//$$$$$$$$.  ;      .e$$$$$!    $$.             .$$  !$$$$$e,      ;  .$$$$$$$$//
//$$$$$$$$$   `.$$$$$$$$$$$$     $$$.         .$$$   $$$$$$$$$$$$.'   $$$$$$$$$//
//$$$$$$$$    .$$$$$$$$$$$$$!     $$`$$$$$$$$'$$    !$$$$$$$$$$$$$.    $$$$$$$$//
//$$$$$$$     $$$$$$$$$$$$$$$$.    $    $$    $   .$$$$$$$$$$$$$$$$     $$$$$$$//
//                                 $    $$    $								   //
//                                 $.   $$   .$								   //
//                                `$        $'								   //
//                                 `$$$$$$$$'								   //
/////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////

#include <bits/stdc++.h>
using namespace std;

// Type-Define 
typedef long long ll;
typedef std::vector<int> vi;
typedef std::vector<std::string> vs;
typedef std::vector<char> vc;
typedef std::vector< vector<int> > vii;
typedef std::pair<int, int> pii;

// Hash-Define
#define int long long
#define MOD 1000000007
#define debugStart cerr << "\n[DEBUG START]\n"
#define debugStop cerr << "\n[DEBUG STOP]\n"
#define KHATAM cout << std::endl;
#define set_zero(x) memset(x, 0, sizeof(x));
#define ForPrint(x) std::for_each( begin(x), end(x), []( auto const& el ){ std::cout << el << " ";  } )

//Functions 
template<typename T> auto gcd ( T a, T b ) -> int  { return (b==0)?a:gcd(b,a%b); }

const int inf = 1e9 + 5;
const int mod = 1e9 + 7;
std::vector< std::vector<int> > adj;
int N, M;

auto solve ( ) -> int {
    int N, M;
    std::cin >> N >> M;
    char input[N][M];
    for ( int i = 0; i < N; ++i ) {
        for ( int j = 0; j < M; ++j ) {
            std::cin >> input[i][j];
        }
    }
    int dp[N][M];
    memset(dp, 0, sizeof(dp));
    if( input[0][0] == '#' ) return 0;
    dp[0][0] = 1;
    for ( int i = 0; i < N; ++i ) {
        for ( int j = 0; j < M; ++j ) {
            if( input[i][j] == '.' ) {
               if( i+1 < N ) dp[i+1][j] = ( dp[i+1][j] + dp[i][j] ) % mod;
               if( j+1 < M ) dp[i][j+1] = ( dp[i][j+1] + dp[i][j] ) % mod; 
            } else {
                dp[i][j] = 0;
            }
        }
    }
    return dp[N-1][M-1];
}

signed
main() {

    ios::sync_with_stdio(0);
    cin.tie(0);
    int T = 1; 
    //cin >> T;
    for ( int testcase = 1; testcase <= T; ++testcase ) {
        
        std::cout << solve(); 
        KHATAM;
    }
    return 0;
}


Measured memory_bytes: 9088