// Original C++ solution (slower):
#include<bits/stdc++.h>

#define ll long long

using namespace std;

#define mod 1000000007

ll h,w;

char ar[1001][1001];

ll dp[1001][1001];



ll path(ll i,ll j){

    if(i==h-1&&j==w-1) return 1;

    if(dp[i][j]!=-1) return dp[i][j];

    ll x=0,y=0;

    if(i+1<h&&ar[i+1][j]!='#') x=path(i+1,j);

    if(j+1<w&&ar[i][j+1]!='#') y=path(i,j+1);

    return dp[i][j]=(x+y)%mod;

}



int main()

{

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    //freopen("input.txt", "r", stdin);

    //freopen("output.txt", "w", stdout);



    cin>>h>>w;

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

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

            cin>>ar[i][j];

        }

    }

    memset(dp,-1,sizeof(dp));

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

    return 0;

}


// Optimized solution to the same problem (faster):
#include <iostream>

#include <vector>

#include <string>

#include <queue>

#include <stack>

#include <map>

#include <set>

#include <unordered_map>

#include <unordered_set>

#include <cmath>

#include <algorithm>

#include <bitset>  

using namespace std;



//======================================================

#define for1(i,n)  for (int i = 0; i < (int)(n); ++i)

#define for2(i,n)  for (int i = 1; i <=(int)(n); ++i)

#define forr1(i,n)  for (int i = n - 1 ;i <= 0; --i)

#define forr2(i,n)  for (int i = n  ;i < 0; --i)

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

#define allr(v)	   ((v).rbegin()), ((v).rend())

#define clr(v,d)   memset(v, d, sizeof(v))

#define ull        unsigned long long

#define MP(a,b)	   make_pair(a,b)

#define S          second

#define F          first

#define PI         3.14159265359

#define ll         long long

#define sz(v)	   v.size()

#define pb         push_back

#define pp         pop_back

#define bgn        begin

#define N          100000+5

#define	MOD        1e9+7

#define inf        1e18

//======================================================

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

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

//======================================================

ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); }

ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }

ll power(ull a, ull b, ull ret = 1LL) {

	while (b--) ret = (ret * a);

	return ret;

}

//======================================================

/**----------------------Graph Moves----------------* /

//const int fx[]={+1,-1,+0,+0};

//const int fy[]={+0,+0,+1,-1};

//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move

//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move

//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move

//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move

/*------------------------------------------------*/





//

//int depth[30+9];

//int quantity[30 + 9];

//int n , w , airbottle;

//int dp[30+ 9][10000+9];

//int backtrack[30+ 9][10000+9];

//int  dividingForGold(int index , int rmBottle)

//{

//	if (index == n)

//		return 0;

//	if (dp[index][rmBottle] != -1)

//	{

//		return dp[index][rmBottle];

//	}

//	int leave = dividingForGold(index + 1, rmBottle);

//	int take = 0;

//	if (rmBottle >=  depth[index])

//	{

//		take = dividingForGold(index + 1, rmBottle - (depth[index])) + quantity[index];

//	}

//	if (take > leave)

//		backtrack[index][rmBottle] = 1;

//	return dp[index][rmBottle] = max(leave, take);

//

//}





long long grid[1000 + 9][1000 + 9];

char paths[1000 + 9][1000 + 9];

int main()

{

	int h , w;

	cin >> h >> w;

	for (int r = 0; r < h; r++)

	{

		for (int c = 0; c < w; c++)

		{

			char a;

			cin >> a;



			if (a == '#')

				grid[r][c] = 0;

			else if (r == 0 && c == 0)

			{

				grid[r][c] = 1;

			}

			else if (r == 0)

			{

				grid[r][c] = grid[r][c-1] ;

			}

			else if (c == 0)

			{

				grid[r][c] = grid[r -1][c];



			}

			else

			{

				grid[r][c] = grid[r-1][c] % (1000000000 + 7) + grid[r][c - 1] % (1000000000 + 7);

			}

			grid[r][c] %= 1000000000 + 7;



		}

	}

	cout << grid[h - 1][w - 1] ;



}


// Fastest known solution for this problem: