#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define endl "\n"
#define SIZE 1000001
ll parent[1000001];
ll Rank[1000001];
map<int, list<int>> g;
int findParent(int a)
{
    if (parent[a] == a)
    {
        return a;
    }
    else
    {
        parent[a] = findParent(parent[a]);
    }
    return parent[a];
}
void Union(int a, int b)
{
    int parentA = findParent(a);
    int parentB = findParent(b);
    if (parentA == parentB)
    {
        if (Rank[parentA] < Rank[parentB])
        {
            parent[parentA] = parentB;
        }
        else if (Rank[parentB] < Rank[parentA])
        {
            parent[parentB] = parentA;
        }
        else
        {
            parent[parentB] = parentA;
            Rank[parentA]++;
        }
    }
}
ll gcd(ll a, ll b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}
// gcd of a and b
void count(int curIndex, int originalIndex, int &day, vector<int> &days, vector<int> &a)
{
    if (curIndex == originalIndex)
    {
        days[originalIndex - 1] = day;
        return;
    }
    day++;
    count(a[curIndex - 1], originalIndex, day, days, a);
    days[curIndex - 1] = days[originalIndex - 1];
}
void rever(string &str, int index)
{
    index++;
    if (index - 1 < 0)
    {
        return;
    }
    for (int i = 0; i < index; i++)
    {
        if (str[i] == '0')
        {
            str[i] = '1';
        }
        else
        {
            str[i] = '0';
        }
    }
    for (int i = 0; i < index / 2; i++)
    {
        swap(str[i], str[index - i - 1]);
    }
}
ll powe(ll x, ll y)
{
    ll res = 1;
    x = x % mod;

    if (x == 0)
        return 0;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % mod;

        y = y >> 1;
        x = (x * x) % mod;
    }
    return res;
}
int sign(int a)
{
    if (a > 0)
    {
        return 1;
    }
    if (a < 0)
    {
        return -1;
    }
    return 0;
}
int dp[100005];
bool visited[100005];
int dfs(int src)
{
    if (g[src].size() == 0)
    {
        return 0;
    }
    if (dp[src] != -1)
    {
        return dp[src];
    }
    for (auto to : g[src])
    {
        if (visited[to] == false)
        {
            visited[to] = true;
            int len = dfs(to);
            visited[to] = false;
            dp[src] = max(dp[src], len + 1);
        }
    }
    return dp[src];
}
void solve()
{
    int h, w;
    cin >> h >> w;
    char a[h][w];
    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            cin >> a[i][j];
        }
    }
    ll dp[h + 1][w + 1];
    for (int i = 0; i <= h; i++)
    {
        dp[i][0] = 0;
    }
    for (int i = 0; i <= w; i++)
    {
        dp[0][i] = 0;
    }
    for (int i = 1; i <= h; i++)
    {
        for (int j = 1; j <= w; j++)
        {
            if (i == 1 && j == 1)
            {
                dp[i][j] = 1;
            }
            else if (a[i - 1][j - 1] == '.')
            {
                dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
                dp[i][j] = dp[i][j] % mod;
            }
            else
            {
                dp[i][j] = 0;
            }
        }
    }
    cout << dp[h][w] << endl;
}
//STL based comparing
int main()
{

    int t = 1;
    // cin >> t;
    //t = 1;
    for (int i = 1; i <= t; i++)
    {
        //cout << "Case #" << i << ":" << endl;
        solve();
    }
    return 0;
}

Measured memory_bytes: 12420