/*              `-._:  .:'   `:::  .:\           |\__/|           /::  .:'   `:::  .:.-'
                    \      :          \          |:   |          /         :       /    
                     \     ::    .     `-_______/ ::   \_______-'   .      ::   . /      
                      |  :   :: ::'  :   :: ::'  :   :: ::'      :: ::'  :   :: :|       
                      |     ;::         ;::         ;::         ;::         ;::  |       
                      |  .:'   `:::  .:'   `:::  .:'   `:::  .:'   `:::  .:'   `:|       
                      /     :           :           :           :           :    \       
                     /______::_____     ::    .     ::    .     ::   _____._::____\      
                                   `----._:: ::'  :   :: ::'  _.----'                    
                                          `--.       ;::  .--'                           
                                              `-. .:'  .-'                               
                                                 \    /                        
                                                  \  /                                   
                                                   */
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
#define all(v) v.begin(),v.end() 
#define F first
#define S second
#define pa pair<int,int>
#define ld long double 
#define sz(x) x.size()
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define INF 1e18
#define PI 3.14159265
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
priority_queue<int, vector<int>, greater<int> > pq;//Min Heap
double startTime;
double getCurrentTime() {
  return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}
bool isPrime(int n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}
int gcd(int a, int b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
int power(int x, unsigned int y, int p) 
{ 
    int res=1;
    x=x%p;
    while(y>0) 
    {
        if(y&1) res=(res*x)%p; 
        y=y>>1;
        x=(x*x)%p;   
    }
    return res;
}
void outP(int idx)
{
    cout<<"Case #"<<idx<<": ";
}
int n,m;
char grid[1005][1005];
int dp[1005][1005];
const int mod=1e9+7;
int solve(int i,int j)
{
    if(grid[i][j]=='#')
        return 0;
    if(i==n&&j==m)
        return 1;
    if(dp[i][j]!=-1)
        return dp[i][j];
    if(i==n-1)
    {
        for(int idx=j;idx<m;idx++)
        {
            if(grid[i][idx]=='#')
                return 0;
        }
        return 1;
    }
    if(j==m-1)
    {
        for(int idx=i;idx<n;idx++)
        {
            if(grid[idx][j]=='#')
                return 0;
        }
        return 1;
    }
    int ret=0;
    ret=(solve(i+1,j)+solve(i,j+1))%mod;
    return dp[i][j]=ret;
}
int32_t main()
{
    IOS;
    memset(dp,-1,sizeof(dp));
    cin>>n>>m;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
            cin>>grid[i][j];
    }
    cout<<solve(0,0);
    return 0;
}

Measured memory_bytes: 12576