//#pragma GCC optimize ("O2")
//#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
//#include<atcoder/all>
//using namespace atcoder;

#include<cstdio>

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

ll dph[2000], dphw[4000], *naname = dphw + 2000;
const int mod = 1e9 + 7;


int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);


	int H = 0, W = 0;
	char c;
	while ((c = getchar_unlocked()) >= '0') H = H * 10 + c - '0';
	while ((c = getchar_unlocked()) >= '0') W = W * 10 + c - '0';

	getchar_unlocked();
	dph[0] = 1;
	naname[0] = 1;
	ll w = 1;
	ll tmp = 1;
	rep1(i, W - 1) {
		tmp = w;
		if (getchar_unlocked() == '.') {
			dph[i] = w;
			naname[i] = w;
			w = w * 2 % mod;
		}
		else {
			dph[i] = 0;
			naname[i] = 0;
			w = 0;
		}
	}
	getchar_unlocked();

	rep1(i, H - 1) {
		if (getchar_unlocked() == '.') {
			tmp = dph[0];
			w = tmp;
			dph[0] = (tmp + dph[0]) % mod;
			naname[-i] = (tmp + naname[-i]) % mod;
		}
		else {
			w = 0;
			dph[0] = 0;
			naname[-i] = 0;
		}
		if (!(i & 3)) {
			rep1(j, W - 1) {
				if (getchar_unlocked() == '.') {
					tmp = (w + dph[j] + naname[j - i]) % mod;
					w = (w + tmp) % mod;
					dph[j] = (tmp + dph[j]) % mod;
					naname[j - i] = (tmp + naname[j - i]) % mod;
				}
				else {
					w = 0;
					dph[j] = 0;
					naname[j - i] = 0;
				}
			}
		}
		else {
			rep1(j, W - 1) {
				if (!(j & 3)) {
					if (getchar_unlocked() == '.') {
						tmp = (w + dph[j] + naname[j - i]) % mod;
						w = (w + tmp) % mod;
						dph[j] = (tmp + dph[j]) % mod;
						naname[j - i] = (tmp + naname[j - i]) % mod;
					}
					else {
						w = 0;
						dph[j] = 0;
						naname[j - i] = 0;
					}
				}
				else {
					if (getchar_unlocked() == '.') {
						tmp = w + dph[j] + naname[j - i];
						w = w + tmp;
						dph[j] = tmp + dph[j];
						naname[j - i] = tmp + naname[j - i];
					}
					else {
						w = 0;
						dph[j] = 0;
						naname[j - i] = 0;
					}
				}
			}
		}
		getchar_unlocked();
	}

	printf("%lld\n", tmp % mod);

	Would you please return 0;
}
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>
#include <iomanip>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <complex>
#include <ctime>
#include <bitset>
// #include <atcoder/all>
#include <fstream>
#include <random>

//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;
// using namespace atcoder;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e9;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(ll i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用
#define ret return 0

template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

using Graph = vector<vector<ll>>;

#define ketasitei setprecision(15) //15桁表示

const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const double PI = 3.1415926535897932;

//繰り返し自乗法(N^P mod M)
ll RepeatSquaring(ll N, ll P, ll M) {
	if (P == 0) return 1;
	if (P % 2 == 0) {
		ll t = RepeatSquaring(N, P / 2, M);
		return (t * t) % M;
	}
	return (N * RepeatSquaring(N, P - 1, M)) % M;
}

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << ketasitei;

	ll h, w;
	cin >> h >> w;

	vector<string> s(h);
	// 0:左 1:上 2:左上
	vector<vector<vector<ll>>> dp(h + 1, vector<vector<ll>>(w + 1, vector<ll>(3, 0)));

	rep(i, h)
		cin >> s[i];

	dp[0][0][0] = 0;
	dp[0][0][1] = 0;
	dp[0][0][2] = 0;

	for (ll i = 1; i < h; i++)
	{
		if (s[i][0] == '#')
			break;

		dp[i][0][1] = (RepeatSquaring(2, i - 1LL, MOD));
	}

	for (ll i = 1; i < w; i++)
	{
		if (s[0][i] == '#')
			break;

		dp[0][i][0] = RepeatSquaring(2, i - 1LL, MOD);
	}

	for (ll i = 1; i < h; i++)
	{
		for (ll j = 1; j < w; j++)
		{
			if (s[i][j] == '#')
				continue;

			if (i == 1 && j == 1)
			{
				dp[i][j][2] = 1;
			}

			dp[i][j][0] += 2 * dp[i][j - 1][0] + dp[i][j - 1][1] +			dp[i][j - 1][2];
			dp[i][j][0] %= MOD;

			dp[i][j][1] += dp[i - 1][j][0] +	 2 * dp[i - 1][j][1] +		dp[i - 1][j][2];
			dp[i][j][1] %= MOD;

			dp[i][j][2] += dp[i - 1][j - 1][0] + dp[i - 1][j - 1][1] +		2 * dp[i - 1][j - 1][2];
			dp[i][j][2] %= MOD;

		}
	}



	cout << (dp[h - 1][w - 1][0] + dp[h - 1][w - 1][1] + dp[h - 1][w - 1][2]) % MOD << endl;

	return 0;
}