#include<bits/stdc++.h>
#define next_permutation np //next_permutation(s.begin(),s.end())or arr,arr+3
//qsort( str, size, sizeof( str[0] ), compare ); for strings
// ceil/floor funtion
//upper_bound() return an iterator(important);
//map<pair<int, int>, int> vis;vos({0,0},1) used for positon ;//pair<int ,int >cur={0,0};
//to get 3/2 ceil value ==2 use a=3,b=2;(b+a-1)/2
// a string can be converted into
//Note that the actual problem is to divide the string into two subsequences that both of them are non-decreasing. 
//You can note that this is true because you cannot change the relative order of the elements colored in the same color, but you can write down subsequences of different colors in any order you want.
//agar 1111111 hogaya toh all increasing 
//vector<pair<int, int>> a(n);
    	//for (int i = 0; i < n; ++i) {
    	//	cin >> a[i].first >> a[i].second;
    	//}
    	//sort(a.begin(), a.end());
    	
    	
    	//prime factor
    	/*for(i=2;i*i<n&&k<2;i++)
           {
               if(n%i==0)
               {
                   arr[k]=i;
                   k=k+1;
                   n=n/i;
               }
               
           }*/
           /*
           
           complexity ke maa ki chutttt
           jo idea aa raha hai use implement kar 
           complexity ke maa ki chuut*/
           //fast exponention a^10000=b//logn time/////
           /*while(t--)
     {
        ll n,i,j,k=0,x,y,f=0;
        cin >>n;
        cin >>x;
        
       for(i=1;i<n;i++)
      {
          cin >>y;
          if(x*y>0)x=max(x,y);
          else
          {
              k=k+x;
              x=y;
          }
      }
      k=k+x;
      
      cout<<k<<endl;
     */
     /* for(i=0;i<n/2;i++)
        {
            l=p[i].first+1;
            r=p[i].second+k;
        pref[l]=pref[l]+1;
            pref[r+1]=pref[r+1]-1;
       }
       //Q is l r x
              1 2 3
              2 5 2      
              use this technique+prefix sum
     
     
     
     for(i=2;i<=2*k;i++)
       {
           sum=sum+pref[i];
           pref[i]=sum;
       }
         */ 
/*




for(i=0;i<n;i++)
    sort(v[i].begin(),v[i].end());
     for(i=1;i<n;i++)
     {
         for(j=0;j<v[i].size();j++)
         
         {
            auto it=find(v[i-1].begin(),v[i-1].end(),v[i][j]);
            if(it !=v[i-1].end())
            {
                ans++;
            v[i-1].erase(it);
            }
             
             
         }
     }
     */
#define ll long long
#define pb push_back
#define mp make_pair

/*


PPPPPPPRRRRRRRRRREEEEEEEEEFIXXXXXX SSSSSSSSSSSSUUUUUUUUUUMMMMMMMMMM*/
/*DIV 2 KE 2 MAX SAWAL KARNE hai
        DIV 3 KE MAX 3 SAWAL KARNE HAI
        LUNCHTIME/COOKOFF KE 2 MIN KARNE HAI
        LONG KE 3 MIN KARNE HAI*/
        /*SAWAL PADHE KE BAAD PHELE CONLUSION/FIGUREOUT KAR SAKTA NIKAL KE N=1,N=2,N=0,YE NAHI KE SOLVE KARNE 
        LAG JAY
        KYA KYA POSSIBLE VALUES HO SAKTE HAI
        DIMAG LAGA 
        K*L KO MAX SE MIN TAK PAUCHANA HAI 
        AUR YE MAT SUCH KE NAHI HO SAKTA*/
ll M = 1000000007 ;
ll power(ll x,ll b)
{
    ll res=1;
    if(b==0)
    return 1;
    while(b>0)
    {
      if(b%2!=0)
      res=(res%M*x%M)%M;
      b=b/2;
      x=(x%M*x%M)%M;
      
    }
    return (res+M%M);
}
 int gcd(int a, int b) 
         { 
    // Everything divides 0  
    if (a == 0) 
       return b; 
    if (b == 0) 
       return a; 
   
    // base case 
    if (a == b) 
        return a; 
   
    // a is greater 
    if (a > b) 
        return gcd(a-b, b); 
    return gcd(a, b-a); 
}
 /*for(i=0;i<n-1;i++)
       {
           if(arr[i]==arr[i+1])
           {
               c++;
           }
           else
           {
               v.pb(mp(arr[i],c));
               c=1;
           }
       }
  */
       


  
ll fact[500005], inv[500005];
 
void pre()
{
    fact[0] = 1; inv[0] = 1;
    for(ll i=1;i<500005;i++)
    {
        fact[i] = (fact[i-1]*i)%M;
        inv[i] = power(fact[i],M-2);
    }
    
}
 
ll C(ll n,ll r)
{
    
    ll ans = ((fact[n]*inv[r])%M + M)%M;/////counting nCr aCb;
    ans = ((ans*inv[n-r])%M + M)%M;
    return ans;
}






        
       
using namespace std;

vector<ll>g;
void bin(ll n) 
{ 
    /* step 1 */
    if (n > 1) 
        bin(n/2); 
  
    /* step 2 */
    g.pb(n%2);
    //cout << n % 2; 
} 











int main()
{
    ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
   ll n,m,mod=1000000007;
   cin>>n>>m;
   string s[n];
   ll i;
   for(i=0;i<n;i++)
   cin>>s[i];
   for(i=0;i<m;i++)
   { 
   	  if(s[0][i]=='#')
   	  break;
   }
   //<<i<<" ";
   ll dp[n][m]={0};
   if(i<m)
   {
   	  for(ll j=i;j<m;j++)
   	  dp[0][j]=0;
   }
   	  for(ll j=0;j<i;j++)
   	  dp[0][j]=1;
   	  
		
   
   for(i=0;i<n;i++)
   {
   	if(s[i][0]=='#')
   	break;
   }
   //cout<<i<<" ";
  
   	for(ll j=0;j<i;j++)
   	dp[j][0]=1;
   
   if(i<n)
   {
   
   	for(ll j=i;j<n;j++)
   	dp[j][0]=0;
   }
   
   
   ll j;
  
   for(i=0;i<n;i++)
   {
   	for(j=0;j<m;j++)
   	{
   		if(i>0&&j>0)
   		{
   			if(s[i][j]=='.')
   			{
   				dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod;
   				
			}
			else
			dp[i][j]=0;
		}
   		
	}
	
   }
   cout<<dp[n-1][m-1]%mod;
   
   
  
        
        
        
    



}



Measured memory_bytes: 9088