/*#include<bits/stdc++.h>
using namespace std;

typedef long double                 ld;
typedef long long                   ll;
typedef pair<int,int>               pii;
typedef pair<ll,ll>                 pll;
typedef pair<string , string>       pss;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define F                           first
#define S                           second
#define sep                         ' '
#define endl                        '\n'
#define file_io                     freopen("input.txt" , "r+" , stdin) ; freopen("output.txt" , "w+" , stdout);
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define error(x)                    cerr << "$$$ " << x << '\n';
#define error2(x,y)                 cerr << "#F : " << x << "      #S : " << y << '\n';
#define kill(x)                     return cout << x << endl , 0;
#define pb                          push_back

const ll MXN = 1e3 + 3;
const ll MX5 = 3e5 + 3;
const ll MX6 = 1e6 + 3;
const ll INF = 8e18;
const ll MOD = 1e9 + 7; //998244353;

ll power(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * power(a * a % md, b / 2, md) % md : power(a * a % md, b / 2, md) % md));
}
ll bmm(ll a,ll b){
    return (a%b==0 ? b : bmm(b,a%b));
}
string base2(ll n){
    string a="";while(n>=2){a+=(char)(n%2+'0');n/=2;}a+=(char)(n+'0');reverse(all(a));return a;
}

ll dp[MXN][MXN];
bool vis[MXN][MXN];
int main(){
    fast_io
    //file_io
    ll n;
    cin >> n;
    for(int i=0;i<n;i++){
        string s;
        cin >> s;
        for(int j=0;j<n;j++){
            if(s[j] == '*') vis[i][j]=1;
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(vis[i][j]) continue;
            if(i==0 && j==0){
                dp[0][0] = 1;
            }
            else if(i==0){
                if(!vis[i][j-1]){
                    dp[i][j] = dp[i][j-1] % MOD;
                }
            }
            else if(j==0){
                if(!vis[i-1][j]){
                    dp[i][j] = dp[i-1][j] % MOD;
                }
            }
            else{
                bool f1 = 1, f2 = 1;
                if(vis[i-1][j]) f1 = 0;
                if(vis[i][j-1]) f2 = 0;
                if(f1 && f2){
                    dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % MOD;
                }
                else if(f1){
                    dp[i][j] = dp[i-1][j] % MOD;
                }
                else if(f2){
                    dp[i][j] = dp[i][j-1] % MOD;
                }
            }
        }
    }

    cout << dp[n-1][n-1];
    return 0;
}*/
#include<bits/stdc++.h>
using namespace std;

typedef long double                 ld;
typedef long long                   ll;
typedef pair<int,int>               pii;
typedef pair<ll,ll>                 pll;
typedef pair<string , string>       pss;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define F                           first
#define S                           second
#define sep                         ' '
#define endl                        '\n'
#define file_io                     freopen("input.txt" , "r+" , stdin) ; freopen("output.txt" , "w+" , stdout);
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define error(x)                    cerr << "$$$ " << x << '\n';
#define error2(x,y)                 cerr << "#F : " << x << "      #S : " << y << '\n';
#define kill(x)                     return cout << x << endl , 0;
#define pb                          push_back

const ll MXN = 1e3 + 3;
const ll MX5 = 3e5 + 3;
const ll MX6 = 1e6 + 3;
const ll INF = 8e18;
const ll MOD = 1e9 + 7; //998244353;

ll power(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * power(a * a % md, b / 2, md) % md : power(a * a % md, b / 2, md) % md));
}
ll bmm(ll a,ll b){
    return (a%b==0 ? b : bmm(b,a%b));
}
string base2(ll n){
    string a="";while(n>=2){a+=(char)(n%2+'0');n/=2;}a+=(char)(n+'0');reverse(all(a));return a;
}

ll dp[MXN][MXN];
bool vis[MXN][MXN];

int main(){
    fast_io
    //file_io
    ll n, m;
    cin >> n >> m;
    for(int i=0;i<n;i++){
        string s;
        cin >> s;
        for(int j=0;j<m;j++){
            if(s[j] == '#') vis[i][j]=1;
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            if(vis[i][j]) continue;
            if(i==0 && j==0){
                dp[0][0] = 1;
            }
            else if(i==0){
                if(!vis[i][j-1]){
                    dp[i][j] = dp[i][j-1] % MOD;
                }
            }
            else if(j==0){
                if(!vis[i-1][j]){
                    dp[i][j] = dp[i-1][j] % MOD;
                }
            }
            else{
                bool f1 = 1, f2 = 1;
                if(vis[i-1][j]) f1 = 0;
                if(vis[i][j-1]) f2 = 0;
                if(f1 && f2){
                    dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % MOD;
                }
                else if(f1){
                    dp[i][j] = dp[i-1][j] % MOD;
                }
                else if(f2){
                    dp[i][j] = dp[i][j-1] % MOD;
                }
            }
        }
    }

    cout << dp[n-1][m-1];
    return 0;
}


Measured memory_bytes: 9088