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

using namespace std;

#define ll long long

int n, m; ll paths, mod = 1e9+7, memo[1002][1002];

char c[1002][1002];

ll fix_mod(ll x){

	return (mod + x % mod) % mod;

}

ll solve(int i, int j){

    if(c[i][j] == '#' || i >= n || j >= m) return 0;

    if(i == n-1 && j == m-1) return 1;

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

    paths = fix_mod(solve(i, j+1) + solve(i+1, j));

    return memo[i][j] = paths;

}

int main()

{



    cin>> n>> m;

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

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

            cin>> c[i][j];

        }

    }

    memset(memo, -1, sizeof memo);

    cout<< solve(0, 0);

    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: