#include <bits/stdc++.h>
 
#define ld long double
#define ll long long
#define ull unsigned long long
#define MOD 1000000007
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)


using namespace std;

#define for_list(a) for(auto i:a)
#define f(s,a) for(int i=0;i<s;i++) cin>>a[i]

void start(){
    cout << " DEBUG START "<<endl;
}
void end(){
    cout << " END " << endl;
}

ll power(ll a,ll b){
    ll s;
    if(b == 0)
        return 1;
    if(b == 1)
        return a;
    if(b%2 == 0){
        s = power(a,b/2);
        return ((s%MOD)*(s%MOD))%MOD;
    }
    else{
        s = power(a,(b-1)/2);
        return (((a%MOD)*((s%MOD)*(s%MOD)))%MOD)%MOD;
    }
}

int randomize(){
    return (rand()%10000);
} 

ll modInverse(ll a, ll m) 
{ 
    ll m0 = m; 
    ll y = 0, x = 1;  
    if (m == 1) 
      return 0; 
    while (a > 1) 
    {
        ll q = a / m; 
        ll t = m; 
        m = a % m, a = t; 
        t = y; 
        y = x - q * y; 
        x = t; 
    } 
    if (x < 0) 
       x += m0; 
    return x; 
} 
int binarySearch(int arr[], int l, int r, int x) 
{ 
    if (r >= l) { 
        int mid = l + (r - l) / 2; 
        if (arr[mid] == x) 
            return mid; 
        if (arr[mid] > x) 
            return binarySearch(arr, l, mid - 1, x); 
        return binarySearch(arr, mid + 1, r, x); 
    } 
    return -1; 
}
void swap(int *x, int *y) 
{ 
    int temp = *x; 
    *x = *y; 
    *y = temp; 
} 
std::vector<std::vector<int>> v(100005);
int b[100005];
bool visited[100005];

void dfs(int i){
    visited[i] = true;
    for(int j:v[i]){
        if(!visited[j])
            dfs(j);
    }
}
bool bfs(int i){
    if(visited[i])
        return true;
    queue<int> p;
    visited[i] = true;
    b[i] = 1;
    p.push(i);
    while(!p.empty()){
        for(int l:v[p.front()])
        {
            if(!visited[l])
            {
                b[l] = b[p.front()]^1;
                visited[l] = true;
                p.push(l);
            }
            else{
                if(b[l] == b[p.front()]) return false;
            }
        }
        p.pop();
    }
    return true;
}
int dp[1001][1001];
int main()
{
    FAST;

    clock_t clock_t2,clock_t1 = clock();
    srand(time(NULL));
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #endif
    // cout <<fixed;
    // cout << setprecision(2);

    int k;cin >> k;
    int m;cin >> m;
    for (int i = 0; i < 1001; ++i)
    {
        fill(dp[i],dp[i]+1001,0);   
    }
    char a[1001][1001];
    for (int i = 0; i < k; ++i)
    {
        cin >> a[i];
    }
    dp[0][0] = 1;
    for (int i = 1; i < k; ++i)
    {
        if(a[i][0] == '.') dp[i][0] = dp[i-1][0]%MOD;
        else dp[i][0] = 0;
    }
    for (int i = 0; i < k; ++i)
    {
        for (int j = 1; j < m; ++j)
        {
            if(i == 0)
            {
                if(a[0][j] == '.') dp[0][j] = dp[0][j-1]%MOD;
                else dp[0][j] = 0;
            }
            else{
                if(a[i][j] == '#') dp[i][j] = 0;
                else{
                    dp[i][j] = (dp[i-1][j] + dp[i][j-1])%MOD;
                }
            }
        }
    }
    // for (int i = 0; i < k; ++i)
    // {
    //     for (int j = 0; j < m; ++j)
    //     {
    //         cout << dp[i][j] << " ";
    //     }
    //     cout << endl;
    // }
    cout << dp[k-1][m-1]%MOD << endl;
    clock_t2 = clock();
    float seconds = clock_t2-clock_t1;
    seconds = seconds/CLOCKS_PER_SEC;
    cerr << "time taken :" << seconds << endl;
}

Measured memory_bytes: 7680