#include<bits/stdc++.h>
using namespace std;
void print_err() {
	cerr << "\n";
}
template <class T, class... Arg>
void print_err(T x, Arg&&... args) {
	cerr << x << " ";
	print_err(args...);
}
template<class T>
void print_container(T &cont) {
	for (auto iter : cont) {
		cerr << iter << " ";
	}
	cerr << "\n";
}
#ifdef local
#define debug(...) print_err(_VA_ARGS_)
#define debug_c(container) print_container(container)
#else
#define debug(...)
#define debug_c(container)
#endif
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define mod 1000000007
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define vl vector<ll>
#define vpll vector<pair<ll,ll>>
#define mll map<ll,ll>
#define mllrev map<ll,ll,greater<int>>
#define ps(x,y) fixed<<setprecision(y)<<x
#define w(t) ll t;cin>>t;while(t--)
#define fo(i,n) for(ll i=0;i<n;++i)
#define foab(i,a,b) for(ll i=a;i<b;++i)
#define inp cin>>
#define pr cout<<
#define all(A) (A).begin(),(A).end()
#define fastio ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL);
class Graph {
public:
	list<ll> *adj_list;
	ll v;
	Graph(ll v) {
		this->v = v;
		adj_list = new list<ll>[v];
	}
	void add_edge(ll u, ll v, bool bidirectional = true) {
		adj_list[u].push_back(v);
		if (bidirectional) {
			adj_list[v].push_back(u);
		}
	}
	void print();
	void connected_compo();
	void dfs(vector<vector<ll>> vect, ll k1, ll k2, ll n);
	void bfs(ll v, bool visited[]);
};
ll recursive(vector<vector<int>> &vect, vector<vector<int>> &dp, ll r, ll c) {
	if (r == 0 and c == 0) {
		return 1;
	}
	if (r < 0 or c < 0) {
		return 0;
	}
	if (vect[r][c] == -1) {
		return 0;
	}
	if (dp[r][c] != 0) {
		return dp[r][c];
	}
	// cout << r << " " << c << endl;
	return dp[r][c] = (recursive(vect, dp, r - 1, c) % mod + recursive(vect, dp, r, c - 1) % mod) % mod;
}
void solve() {
	// cout << "fgh";
	ll n, m;
	inp n >> m;
	char ch;
	vector<vector<int>> vect(n, vector<int>(m, 0)), dp(n, vector<int>(m, 0));
	fo(i, n) {
		fo(j, m) {
			inp ch;
			if (ch == '#') {
				vect[i][j] = -1;
			}
		}
	}
	dp[0][0] = 1;
	ll temp = 0;
	fo(i, n) {
		if (vect[i][0] == -1) {
			temp = i;
			break;
		}
	}
	if (temp != 0) {
		fo(i, temp) {
			dp[i][0] = 1;
		}
	} else {
		fo(i, n) {
			dp[i][0] = 1;
		}
	}
	temp = 0;
	fo(i, m) {
		if (vect[0][i] == -1) {
			temp = i;
			break;
		}
	}
	if (temp != 0) {
		fo(i, temp) {
			dp[0][i] = 1;
		}
	} else {
		fo(i, m) {
			dp[0][i] = 1;
		}
	}
	// fo(i, n) {
	// 	fo(j, m) {
	// 		cout << dp[i][j] << " ";
	// 	}
	// 	cout << endl;
	// }
	foab(i, 1, n) {
		foab(j, 1, m) {
			if (vect[i][j] == 0) {
				dp[i][j] = (dp[i - 1][j] % mod + dp[i][j - 1] % mod) % mod;
			}
		}
	}
	cout << dp[n - 1][m - 1] << endl;
	return;
}
//Rod cutting problem test case
// 5
// 100
// 23 15 50
// 4000
// 3 4 5
// 7
// 5 5 2
// 4
// 2 1 1
// 5
// 5 3 2
int main() {
	fastio
#ifdef local
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("error.txt", "w", stderr);
#endif
	// w(t) {
	solve();
	// }
	return 0;
}

Measured memory_bytes: 11012