// Slower C++ solution:
#include<bits/stdc++.h>

#define ll long long

#define ull unsigned long long

#define IO ios::sync_with_stdio(false), cin.tie(0)

#define endl '\n'

#define main() int main()

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

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

#define pi acos(-1.0)

#define ms(a, x) memset(a, x, sizeof(a))

#define lowbit(x) ((x)&(-(x)))

#define pb push_back

#define binarycount __builtin_popcount(x)

#define tr t[root]

#define lson t[root << 1]

#define rson t[root << 1 | 1]

#define fir first

#define sec second

#define debug(x) cout<<x<<'\n'

#define sa(a) scanf("%d", &a)

#define sab(a, b) scanf("%d%d", &a, &b)

#define pa(a) printf("%d",a)

#define pab(a,b) printf("%d%d",a,b)

#define pii pair<string,int>

using namespace std;

#define maxn 1005

const int inf = 0x3f3f3f3f;

const int mod = 1e9+7;

const double eps = 1e-8;

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

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

int max(int x,int y){if(x>y) return x;return y;}

ll powmod(ll a,ll b){

    ull ans = 1, pow = a%mod;

    while(b) { if(b&1) ans = (ans*pow)%mod; pow = (pow*pow)%mod; b >>= 1; }

    return ans%mod;

}



int n,m;

char mp[maxn][maxn];

int dp[maxn][maxn];

main()

{

	IO;

	cin>>n>>m;

	ms(dp,0);

	for(int i=1;i<=n;i++)

		for(int j=1;j<=m;j++)

		 cin>>mp[i][j];

		 

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

		if(mp[i][1]=='#')break;

		dp[i][1]=1;

	}	 

	for(int i=1;i<=m;i++){

		if(mp[1][i]=='#')break;

		dp[1][i]=1;

	}

	for(int i=2;i<=n;i++)

	{

		for(int j=2;j<=m;j++)

		{

			if(mp[i][j]=='#')continue;

			if(mp[i-1][j]!='#'){

				dp[i][j]=(dp[i][j]+dp[i-1][j])%mod;

			}

			if(mp[i][j-1]!='#'){

				dp[i][j]=(dp[i][j]+dp[i][j-1])%mod;

			}

		}

	}



	cout<<dp[n][m]%mod<<endl;

	

}


// Faster C++ solution for the same problem (measured speedup: 5.085464731172098x):
#include <bits/stdc++.h>

using namespace std;

#define ll long long

#define endl "\n"

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

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

#define NN 8010000

#define TC int t;cin>>t;for(int T=1;T<=t;T++)

#define mod 1000000007

#define PI acos(-1)

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

#define rall(x) (x).rbegin(),(x).rend()

#define mem(a,n) memset(a,n,sizeof(a))

void AIA() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); }

//cout<<fixed<<setprecision(20);

// freopen("stand.in","r",stdin);

// freopen("stand.out","w",stdout);

bool isprime(ll n) {

	for (ll i = 2; i * i <= n; i++) {

		if (n % i == 0)return 0;

	}

	return (n!=1);

}

ll gcd(ll x, ll y)

{

	return (y == 0 ? x : gcd(y, x % y));

}

ll lcm(ll a, ll b) {

	return a / gcd(a, b) * b;

}

ll rem(int x, int N){

	return (x % N + N) % N;

}

int n,m;

ll dp[1007][1007];

char arr[1007][1007];



int main()

{

	//cout<<fixed<<setprecision(6);

	AIA();

	int n,m;

	cin>>n>>m;

	dp[0][0] = 1;

	for(int i=0;i<n;i++)for(int j=0;j<m;j++)cin>>arr[i][j];

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

		if(arr[i][j] == '#')continue;

		if(i == 0 && j == 0)continue;

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

		else if(j == 0)dp[i][j] = dp[i-1][j];

		else dp[i][j] = ((dp[i][j] % mod) + (dp[i - 1][j] % mod) + (dp[i][j - 1] % mod)) % mod;

	}	

	cout << dp[n-1][m-1];

	return 0;

}