// Slower C++ solution:
#define _CRT_SECURE_NO_WARNINGS

#include<bits/stdc++.h>

#include<iostream>

#include<algorithm>

#include<iomanip>

#include<string>

#include<cmath>

#include<vector>

#include<set>

#include<queue>

#include<stack>

#include<fstream>

#include<map>

#include<bitset>

#include<unordered_map>

#include<cstring>

#include<cctype>

using namespace std;

#define  ll long long

#define  ull unsigned long long

#define  ul unsigned long

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

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

#define pb(s) push_back(s);

#define format(n) fixed<<setprecision(n)

#define finl "\n"

#define Mohammed_Atef_Hassan fast();

#define mod 1000000007

#define INF LLONG_MAX

#define PI acos(-1)

#define clr(dp,n) memset(dp,n,sizeof dp)

#define ex(n) return cout<<n<<finl,0;

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

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

ll fix_mod(ll x, ll y)

{

	return (y + x % y) % y;

}

void fast() {

	std::ios_base::sync_with_stdio(false);

	cin.tie(nullptr); cout.tie(nullptr);

}

char g[1001][1001]; int n, m;

ll mem[1001][1001];

ll solve(int x, int y)

{

	if (x == n || y == m||g[x][y]=='#')return 0;

	if (x == n - 1 && y == m - 1)return 1;

	ll& ret = mem[x][y];

	if(~ret)return ret;

	 ret = solve(x + 1, y) + solve(x, y + 1);

	 return ret %= 1000000007;

}

int main()

{

	Mohammed_Atef_Hassan

		clr(mem, -1);

		cin >> n >> m;

	for (int i = 0; i < n; i++)

		for (int j = 0; j < m; j++)

			cin >> g[i][j];

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

}

// Faster C++ solution for the same problem (measured speedup: 9.422726642040582x):
#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;

}