#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")

// Use g++ compiler for this include to work.
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

// Constants 
#define INF 2e18
#define EPS 1e-9
#define MOD 1000000007 
 
// // for using in pairs
#define F first
#define S second
 
// Macros
#define all(x) begin(x), end(x)
#define allr(x) rbegin(x), rend(x)

// aliases
using ll = long long;
using ull = unsigned long long;
using ui = unsigned int;
using ld = long double;

template<typename T>
using oset = tree<T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;

// Temporary macro.
#define int long long

// Operator overloads.

/**
 * Both types in the pair should have overload for << operator with ostream. 
 */
template<typename T1, typename T2>
ostream& operator<<(ostream &ostream, pair<T1, T2>& p)
{
	ostream << p.first << " " << p.second;
	return ostream;
}

/**
 * The type of element in the vector should have overload for << operator with ostream. 
 */
template<typename T>
ostream& operator<<(ostream &stream, vector<T>& v)
{
	for (const auto &it : v)
		stream << it << " ";
	return stream;
}

template<typename T1, typename T2>
istream& operator>>(istream &istream, pair<T1, T2>& p)
{
	istream >> p.first >> p.second;
	return istream;
}

template<typename T>
istream& operator>>(istream &istream, vector<T>& a)
{
	for (auto &it : a)
		istream >> it;
	return istream;
}

// Utility functions.

template<typename T>
T MIN(T first) { return first; }

template<typename T, typename... Args>
T MIN(T first, Args... args) { return min(first, MIN(args...)); }

template<typename T>
T MAX(T first) { return first; }

template<typename T, typename... Args>
T MAX(T first, Args... args) { return max(first, MAX(args...)); }

template <typename T>
void DEBUG(T&& t) {cout << t << "\n";}

template <typename T, typename... Args>
void DEBUG(T&& t, Args&&... args) 
{
    cout << t << " ";
    DEBUG(forward<Args>(args)...);
}

template<typename T>
int32_t size_i(T& container) { return static_cast<int32_t>(container.size()); }

// Mathematical functions.

int GCD(int a, int b)
{
	if (!b)
		return a;
	return GCD(b, a % b);
}

int LCM(int a, int b)
{
	return (a * b) / GCD(a, b);
}

int modpow(int x, int n, int m = INF)
{
	if (n == 0) return 1 % m;
	long long u = modpow(x, n / 2, m);
	u = (u * u) % m;
	if (n % 2 == 1)
		u = (u * x) % m;
	return u;	
}

/**
 * m should be prime
 */
int modinv(int x, int m = MOD)
{
	return modpow(x, m - 2, m);
}

//////////////////// START CODE HERE ///////////////////////////

void preSolve() 
{
}

struct comp
{
	int l, t, lt, val;
	comp()
	{
		l = 0;
		t = 0;
		lt = 0;
		val = 0;
	}
	comp(int l, int t, int lt, int val)
		: l(l), t(t), lt(lt), val(val) {}
	int sum() { return l + lt + t; }
};

void solve(int tc)
{
	int n, m;
	cin >> n >> m;
	char a[n + 1][m + 1];
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= m; j++)
			cin >> a[i][j];

	comp dp[n + 1][m + 1];
	for (int i = 0; i <= n; i++)
	{
		for (int j = 0; j <= m; j++)
		{
			if (!i || !j)
				continue;
			if (a[i][j] == '#')
			{
				dp[i][j] = comp();
				continue;
			}
			if (i == 1 && j == 1)
			{
				dp[1][1] = comp(0, 0, 0, 1);
				continue;
			}
			dp[i][j] = comp();
			dp[i][j].l  += (dp[i][j - 1].val + dp[i][j - 1].l) % MOD;
			dp[i][j].t  += (dp[i - 1][j].val + dp[i - 1][j].t) % MOD;
			dp[i][j].lt += (dp[i - 1][j - 1].val + dp[i - 1][j - 1].lt) % MOD;
			dp[i][j].val = (dp[i][j].sum()) % MOD;
		}
	}

	cout << dp[n][m].val;
}

int32_t main() 
{
	#ifdef LOCAL_PROJECT
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#else
		// freopen("input.txt", "r", stdin);
		// freopen("output.txt", "w", stdout);
	#endif

	ios_base::sync_with_stdio(false);
	cin.tie(0);

	preSolve();

	int t = 1;
	// cin >> t;
	for (int i = 1; i <= t; i++)
	{
		solve(i);
	}
	return 0;
}
	
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
const int mod=1000000007;
inline int add(int x,int y)
{
	return ((ll)x+y)%mod;
}
bool g[2005][2005];
int dp[2005][2005],lr[2005][2005],tb[2005][2005],di[2005][2005];
int h,w;
int main()
{
	cin.tie(0);cout.tie(0);
	cin>>h>>w;
	for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
		{
			char c;
			cin>>c;
			if(c=='.') g[i][j]=1;
		}
	}
	dp[0][0]=1;
	lr[0][0]=1;
	tb[0][0]=1;
	di[0][0]=1;
	for(int i=1;i<w;i++)
		if(g[0][i]) 
		{
			dp[0][i]=lr[0][i-1];
			lr[0][i]=add(dp[0][i],lr[0][i-1]);
			tb[0][i]=dp[0][i];
			di[0][i]=dp[0][i];
		}
	int la;
	for(int i=1;i<h;i++)
	{
		if(g[i][0]) 
		{
			dp[i][0]=tb[i-1][0];
			tb[i][0]=add(tb[i-1][0],dp[i][0]);
			lr[i][0]=dp[i][0];
			di[i][0]=dp[i][0];
		}
		for(int j=1;j<w;j++)
			if(g[i][j]) 
			{
				dp[i][j]=add(add(tb[i-1][j],lr[i][j-1]),di[i-1][j-1]);
				tb[i][j]=add(tb[i-1][j],dp[i][j]);
				lr[i][j]=add(lr[i][j-1],dp[i][j]);
				di[i][j]=add(di[i-1][j-1],dp[i][j]);
			}
	}
	cout<<dp[h-1][w-1]<<endl;
	return 0;
}