#pragma GCC optimize(2)
#include<unordered_map>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<cmath>
#include<map>
#include<set>
#define Buff ios::sync_with_stdio(false)
#define rush() int Case = 0; int T; cin >> T;  while(T--)
#define rep(i, a, b) for(int i = a; i <= b; i ++)
#define per(i, a, b) for(int i = a; i >= b; i --)
#define reps(i, a, b) for(int i = a; b; i ++)
#define clc(a, b) memset(a, b, sizeof(a))
#define Buff ios::sync_with_stdio(false)
#define readl(a) scanf("%lld", &a)
#define readd(a) scanf("%lf", &a)
#define readc(a) scanf("%c", &a)
#define reads(a) scanf("%s", a)
#define read(a) scanf("%d", &a)
#define lowbit(n) (n&(-n))
#define pb push_back
#define lson rt<<1
#define rson rt<<1|1
#define ls lson, l, mid
#define rs rson, mid+1, r
#define y second
#define x first
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int>PII;
const double eps = 1e-6;
const int INF = 1e9 + 7;
const int N = 2007;
const int M = 1e6 + 7;
const ll mod = 1e9 + 7;
ll dp[N][N];
ll sum[4][N][N];
char a[N][N];
signed main()
{
    Buff;
    int n, m;
    cin >> n >> m;
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= m; j++)
            cin >> a[i][j];
    dp[1][1] = sum[1][1][1] = sum[2][1][1] = sum[3][1][1] = 1;
    for(int i = 1; i <= n; i++)
    {
        for(int j = 1; j <= m; j++)
        {
            if(a[i][j] == '#' || (i == j && j == 1))
                continue;
            else
            {
                dp[i][j] = (sum[1][i - 1][j] + sum[2][i][j - 1] + sum[3][i - 1][j - 1]) % mod;
                sum[1][i][j] = (sum[1][i - 1][j] + dp[i][j]) % mod;
                sum[2][i][j] = (sum[2][i][j - 1] + dp[i][j]) % mod;
                sum[3][i][j] = (sum[3][i - 1][j - 1] + dp[i][j]) % mod;
            }
        }
    }
    cout << dp[n][m] << endl;
    return 0;
}
#include <iostream>
#include <string>
#include <vector>
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i))
#define ALL(x) ::std::begin(x), ::std::end(x)
using namespace std;

constexpr int64_t MOD = 1000000007;
int64_t solve(int H, int W, const vector<string> & S) {
    vector<vector<int64_t>> count(H+1, vector<int64_t>(W+1));
    vector<vector<int64_t>> count_horizontal(H+1, vector<int64_t>(W+1));
    vector<vector<int64_t>> count_vertical(H+1, vector<int64_t>(W+1));
    vector<vector<int64_t>> count_diagonal(H+1, vector<int64_t>(W+1));

    // 初期値設定
    count.at(1).at(1) = 1;
    count_horizontal.at(1).at(1) = 1;
    count_vertical.at(1).at(1) = 1;
    count_diagonal.at(1).at(1) = 1;

    for (int y=1; y <= H; y++) {
        for (int x=1; x <= W; x++) {
            if (x == 1 and y == 1) {
                continue;
            }

            if (S.at(y-1).at(x-1) == '#') {
                count.at(y).at(x) = 0;
                count_horizontal.at(y).at(x) = 0;
                count_vertical.at(y).at(x) = 0;
                count_diagonal.at(y).at(x) = 0;
                continue;
            }

            int64_t count_h = count_horizontal.at(y).at(x-1);
            int64_t count_v = count_vertical.at(y-1).at(x);
            int64_t count_d = count_diagonal.at(y-1).at(x-1);
            int64_t sum_count = ((count_h + count_v) % MOD + count_d) % MOD;

            count.at(y).at(x) = sum_count;
            count_horizontal.at(y).at(x) = (sum_count + count_h) % MOD;
            count_vertical.at(y).at(x) = (sum_count + count_v) % MOD;
            count_diagonal.at(y).at(x) = (sum_count + count_d) % MOD;
        }
    }

    return count.at(H).at(W);
}

// generated by online-judge-template-generator v4.7.1 (https://github.com/online-judge-tools/template-generator)
int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    constexpr char endl = '\n';
    // failed to analyze input format
    // TODO: edit here
    int H;
    int W;
    cin >> H;
    cin >> W;
    vector<string> S(H);
    REP (i, H) {
        cin >> S.at(i);
    }
    auto ans = solve(H, W, S);
    cout << ans << endl;
    return 0;
}
