// Slower C++ solution:
#include <bits/stdc++.h>

 

using namespace std;

 

#define sf(n) scanf("%d", &n)

#define pd(n) printf("%.12lf", n)

#define pf(n) printf("%d", n)

#define p() printf("\n")

#define ps() printf(" ")

#define ll long long

#define ull unsigned long long

#define MAX 1e9

const int mod = 1000 * 1000 * 1000 + 7;

#define ex 1e18

#define dbl 2e09

#define qu(q) queue<int> q

#define pqu(q) priority_queue<int> q

#define len(s) s.length()

#define sz(x) int(x.size())

#define pb(x) push_back(x)

#define all(x) x.begin(), x.end()

#define rall(x) x.rbegin(), x.rend()

#define F first

#define S second

#define clr(x) x.clear()

#define LOG(x) std::cout << x << std::endl;

 

const int INF = 0x3f3f3f3f;

const ll LL_INF = 0x3f3f3f3f3f3f3f3f;

const double PI = 3.14159265359;

 

int dx[6] = {-1,-1,0,0,1,1};

int dy[6] = {-1,0,-1,1,0,1};



int w,h;

char a[1005][1005];

int dp[1005][1005];



int solve(int i,int j){

    if(i==(h-1)and j==(w-1))

        return 1;

    if(i>=h or j>=w)

        return 0;

    int &ret=dp[i][j];

    if(~ret)return ret;

    ret=0;

    if((i+1)<h and a[i+1][j]!='#'){

        ret+=solve(i+1,j)%mod;

    }

    if((j+1)<w and a[i][j+1]!='#'){

        ret+=solve(i,j+1)%mod;

    }

    return ret%mod;

}





int main(){

    cin>>h>>w;

    for(int i=0;i<h;++i){

        for(int j=0;j<w;++j){

            cin>>a[i][j];

        }

    }

    memset(dp,-1,sizeof dp);

    cout<<solve(0,0)<<endl;



    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.127112718986453x):
#include <bits/stdc++.h>

using namespace std;

#define INF 2000000000

typedef long long int ll;

typedef pair<ll,ll> ii;

typedef vector<ll> vi;

typedef vector<ii> vii;

#define getbit(n,i) (((n)&(1<<(i)))!=0)

#define setbit0(n,i) ((n)&(~(1<<(i))))

#define setbit1(n,i) ((n)(1<<(i)))

#define togglebit(n,i) ((n)^(1<<(i)))

#define lastone(n) ((n)&(-(n)))

#define read freopen("debug\\in.txt","r",stdin)

#define write freopen("debug\\out.txt","w",stdout)

#define fi first

#define se second

#define getI(a) scanf("%d",&a)

#define getII(a,b) scanf("d",&a,&b)

#define PI (acos(-1))

#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL)

#define mod (1000000007)

#define asz 500005

#define t int t;scanf("%d",&t);for(int v=1;v<=t;v++)

#define loop_arr(i,a,b) for(int i=a;i<b;i++)

#define loop_norm(i,a,b) for(int i=a;i<=b;i++)

#define minheap priority_queue<int,vector<int>,greater<int> >

#define maaheap priority_queue<int>

#define pb push_back

#define newl "\n"

ll BIGMOD ( ll a, ll p, ll m )

{

    ll result = 1;

    ll x = a;



    while ( p )

    {

        if ( p & 1 ) //p is odd

        {

            result = ( result * x ) % m;

        }

        x = ( x * x ) % m;

        p = p >> 1;

    }



    return result;

}



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;

}



void SieveOfEratosthenes(int n)

{

    bool prime[n+1];

    memset(prime, true, sizeof(prime));



    for (int p=2; p*p<=n; p++)

    {



        if (prime[p] == true)

        {

            for (int i=p*p; i<=n; i += p)

                prime[i] = false;

        }

    }

}

int row,col;

int grid[1005][1005];

ll memo[1005][1005];

void dp()

{

    memo[0][0]=1;

   for(int i=1;i<row;i++)

   {

      if(grid[i][0]==1)

      {

       if(memo[i-1][0]==1)   memo[i][0]=1;

       else memo[i][0]=0;

      }

      else memo[i][0]=0;

   }

   for(int i=1;i<col;i++)

   {

      if(grid[0][i]==1)

      {

       if(memo[0][i-1]==1)   memo[0][i]=1;

       else memo[0][i]=0;

      }

      else memo[0][i]=0;

   }

   for(int i=1;i<row;i++)

   {

       for(int j=1;j<col;j++)

       {

           if(grid[i][j]==0) memo[i][j]=0;

           else memo[i][j]=(memo[i-1][j]+memo[i][j-1])%mod;

       }

   }

}

int main()

{

  // fastread;

   cin>>row>>col;

   char ch;

   loop_arr(i,0,row)

   {

       loop_arr(j,0,col)

       {

           cin>>ch;

           if(ch=='.') grid[i][j]=1;

           else grid[i][j]=0;

       }

   }

   dp();

   cout<<memo[row-1][col-1]<<newl;



  return 0;

}