#include <bits/stdc++.h>

using namespace std;

#define all(x) x.begin(), x.end()
#define sz(x) (int) x.size()
#define pb push_back
#define endl '\n'
#define snd second
#define fst first
#define fastio cin.tie(NULL),cout.sync_with_stdio(true)

//typedef long long int ll;
typedef unsigned long long int ull;
typedef vector <int> vi;
typedef pair <int, int> ii;

const int mod = 1e9 + 7;
//const ll INF = 1e18;
const double EPSILON = 1e-10;
const int N = 2005;
char t[N][N];
int l[N][N], c[N][N], d[2][N][N];
vi ll[N], cc[N], dd[2][N];
int add(int a, int b){
    a += b;
    if(a >= mod)
        a -= mod;
    return a;
}
int sub(int a, int b){
    a -= b;
    if(a < 0)
        a += mod;
    return a;
}
int main(){
    fastio;
    int n,m;
    cin >> n >> m;
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= m; j++)
            cin >> t[i][j];
    for(int i = 0; i < N; i++)
        ll[i].pb(0), cc[i].pb(0), dd[0][i].pb(0), dd[1][i].pb(0);
    if(n == 1 and m == 1){
        cout << 1 << '\n';
        return 0;
    }
    l[1][1] = c[1][1] = d[0][0][1] = 1;
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= m; j++){
            if(i == 1 and j == 1)continue;
            if(t[i][j] == '#'){
                ll[i].pb(i);
                cc[j].pb(j);
                if(i-j >= 0){
                    dd[0][i-j].pb(i);
                }else{
                    dd[1][j-i].pb(i);
                }
            }else{
                int tmp = 0;
                tmp = add(tmp, sub(l[i-1][j], (ll[i][sz(ll[i])-1] > 0 ? l[ ll[i][sz(ll[i])-1] ][j] : 0)));
                tmp = add(tmp, sub(c[i][j-1], (cc[j][sz(cc[j])-1] > 0 ? c[i][ cc[j][sz(cc[j])-1] ] : 0)));

                if(i-j>=0){
                    tmp = add(tmp, sub(d[0][i-j][i-1], (dd[0][i-j][sz(dd[0][i-j])-1] > 0 ? d[0][i-j][ dd[0][i-j][sz(dd[0][i-j])-1] ] : 0)));
                }else{
                    tmp = add(tmp, sub(d[1][j-i][i-1], (dd[1][j-i][sz(dd[1][j-i])-1] > 0 ? d[1][j-i][ dd[1][j-i][sz(dd[1][j-i])-1] ] : 0)));
                }
                if(i == n and j == m){
                    cout << tmp << '\n';
                }
                l[i][j] = add(l[i-1][j], tmp);
                c[i][j] = add(c[i][j-1], tmp);
                if(i-j >= 0){
                    d[0][i-j][i] = add(d[0][i-j][i-1], tmp);
                }else{
                    d[1][j-i][i] = add(d[1][j-i][i-1], tmp);
                }
            }
        }
    }
    return 0;
}

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")

#define int long long
#define ll long long
#define all(v) v.begin(), v.end()
#define intvect vector<int>
#define pii pair<int, int>
#define mii map<int, int>
#define fo(i, n) for (int i = 0; i < n; ++i)
#define Fo(i, k, n) for (int i = k; i < n; ++i)
#define ld long double
#define deb(x) cout << #x << " " << x << endl;
#define pb push_back
#define pob pop_back
#define lcm(a, b) (a / __gcd(a, b) * b)
#define F first
#define S second
#define ull unsigned long long

typedef tree<int, null_type, less<int>, rb_tree_tag,
             tree_order_statistics_node_update>
    indexed_set;

const ll mod = 1e9 + 7;
const ll N = (ll)2e3 + 4;

template <typename... T>
void read(T &... args)
{
    ((cin >> args), ...);
}

template <typename... T>
void write(T &&... args)
{
    ((cout << args), ...);
}

void vjudge()
{
#ifndef RTE
    if (fopen("input.txt", "r"))
    {
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    }
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
string s[N];
int dp[N][N];
int phor[N][N];
int pver[N][N];
int pdig[N][N];

bool wall(int x, int y)
{
    if (s[x - 1][y - 1] == '#')
        return 1;
    return 0;
}
void solve()
{
    int h, w;
    cin >> h >> w;
    for (int i = 1; i < h + 1; i++)
        cin >> s[i - 1];
    dp[1][1] = 1;
    pdig[1][1] = 1;
    pver[1][1] = 1;
    phor[1][1] = 1;

    for (int i = 1; i < h + 1; i++)
    {
        for (int j = 1; j < w + 1; j++)
        {
            if ((i == 1 and j == 1) or wall(i, j))
                continue;

            dp[i][j] = (phor[i][j - 1] + pver[i - 1][j] + pdig[i - 1][j - 1]) % mod;

            phor[i][j] = (dp[i][j] + phor[i][j - 1]) % mod;
            pver[i][j] = (dp[i][j] + pver[i - 1][j]) % mod;
            pdig[i][j] = (dp[i][j] + pdig[i - 1][j - 1]) % mod;
        }
    }
    cout << dp[h][w];
}
int32_t main()
{
    clock_t start, end;
    start = clock();
    vjudge();
    int t = 1;
    // cin >> t;
    while (t--)
        solve();
    end = clock();
    double waste = double(end - start) / double(CLOCKS_PER_SEC);
    cerr << "Time wasted by program is : " << fixed
         << waste << setprecision(15);
    cerr << " sec " << endl;
}