#include <bits/stdc++.h>
using namespace std;
#include <algorithm>
template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string &s) { return '"' + s + '"'; }

string to_string(const char *s) { return to_string((string)s); }

string to_string(bool b) { return (b ? "true" : "false"); }

string to_string(vector<bool> v) {
    bool first = true;
    string res = "{";
    for (int i = 0; i < static_cast<int>(v.size()); i++) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(v[i]);
    }
    res += "}";
    return res;
}

template <size_t N>
string to_string(bitset<N> v) {
    string res = "";
    for (size_t i = 0; i < N; i++) {
        res += static_cast<char>('0' + v[i]);
    }
    return res;
}

template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto &x : v) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " +
           to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);

    debug_out(T...);
}
#define LOCAL 1
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

typedef vector<int> VI;
typedef pair<char, char> PII;

#define ls (v << 1)
#define rs (ls | 1)
#define tm ((tl + tr) >> 1)

typedef long long LL;
#define si(x) int(x.size())
#define eps 1e-9
#define ALL(x) x.begin(), x.end()
#define INS(x) inserter(x, x.begin())
#define FOR(i, j, k) for (int i = j; i <= k; i++)

#define cls(x) memset(x, 0, sizeof x)
#define inf(x) memset(x, 0x3f, sizeof x)
#define neg(x) memset(x, -1, sizeof x)
#define ninf(x) memset(x, 0xc0, sizeof x)

#define MAXM (int)1e5 + 10
#define MAX 1e4 + 10

#define INF 0x3f3f3f3f
using namespace std;
constexpr int maxn = 200000;

LL gcd(LL a, LL b) { return b ? gcd(b, a % b) : a; }

LL A[maxn + 1];
struct Node {
    LL ans, sum, size;
    Node operator+(const Node &node) const {
        Node res;
        res.size = size + node.size;

        if (size & 1)
            res.sum = sum - node.sum;
        else
            res.sum = sum + node.sum;

        if (size & 1)
            res.ans = ans - node.ans - size * node.sum;
        else
            res.ans = ans + node.ans + size * node.sum;

        return res;
    }
} T[maxn << 2];

void build(int v, int tl, int tr) {
    if (tl == tr) {
        T[v].size = 1;
        T[v].ans = T[v].sum = A[tm];
    } else {
        build(ls, tl, tm);
        build(rs, tm + 1, tr);
        T[v] = T[ls] + T[rs];
    }
}

void update(int v, int tl, int tr, int x, int V) {
    if (tl == tr) {
        T[v].ans = T[v].sum = V;
    } else {
        if (x <= tm)
            update(ls, tl, tm, x, V);
        else
            update(rs, tm + 1, tr, x, V);
        T[v] = T[ls] + T[rs];
    }
}

Node query(int v, int tl, int tr, int l, int r) {

    if (l <= tl and tr <= r)
        return T[v];
    if (r <= tm)
        return query(ls, tl, tm, l, r);
    if (l > tm)
        return query(rs, tm + 1, tr, l, r);
    return query(ls, tl, tm, l, r) + query(rs, tm + 1, tr, l, r);
}
int a[110];
unordered_set<int> vis;
int dp[MAXM];
int mx = 0;
int dfs(int p) {

    if (p == 0 or (p <= mx and !vis.count(p))) {
        return 0;
    }
    debug(p);
    if (dp[p] != -1)
        return dp[p];

    for (auto x : vis) {

        if (p >= x and !dfs(p - x)) {
            dp[p] = 1;
            return 1;
        }
    }

    dp[p] = 0;
    return 0;
}
void solve() {
    int h, w;
    cin >> h >> w;

    int matrix[h][w] = {};
    for (int i = 0; i < h; ++i) {
        string s;
        cin >> s;
        for (int j = 0; j < w; ++j) {
            if (s[j] == '.')
                matrix[i][j] = 1;
            else
                matrix[i][j] = 0;
        }
    }
    int dp[h + 1][w + 1] = {};
    dp[1][1] = 1;
    int mod = 1e9 + 7;
    for (int i = 1; i <= h; ++i) {

        for (int j = 1; j <= w; ++j) {
            if (i - 1 >= 1) {
                if (matrix[i - 1][j - 1] == 1) {
                    dp[i][j] = (dp[i][j] + dp[i - 1][j]) % mod;
                }
            }
            if (j - 1 >= 1) {
                if (matrix[i - 1][j - 1] == 1) {
                    dp[i][j] = (dp[i][j] + dp[i][j - 1]) % mod;
                }
            }
        }
    }

    cout << dp[h][w] << endl;
}

int main() {
    // freopen("in.txt", "r", stdin);
    std::ios::sync_with_stdio(false);
    cin.tie(0);
    int t = 1;

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

    return 0;
}


Measured memory_bytes: 8064