// Slower C++ solution:
#include<iostream>

#include <bits/stdc++.h>

using namespace std;

typedef pair<int, int> pii;

typedef pair<int, pii> piii;

typedef pair<double, pii> pdii;

typedef vector<int> vi;

typedef vector<pii> vii;

typedef long long ll;

typedef set<int> set1 ;



#define loop(i,n)          for(int i = 0; i < n; ++i)

#define lp(x, s, e)      for(int x = (s); x < (e); x++)

#define lpe(x, s, e)     for(int x = (s); x <= (e); x++)

#define MP make_pair

#define PB push_back

#define sizeofarr(a) (sizeof(a)/sizeof(a[0]))

#define len(s)   (int)s.length()

#define sz(v)    (int)v.size()

#define all(a)   a.begin(),a.end()

#define clr(x, val)	memset((x), (val), sizeof(x))

#define ln '\n'

#define INF 1e8

typedef unsigned long long ull;

typedef long long ll;



#define MAXNODES (100000)+9

vector<vi> edges (MAXNODES);

vector<set1> edges2 (MAXNODES);



vector<int> visited (MAXNODES , -1);

vi dfsvec ;

vi leafs;

int color [MAXNODES] ;

vi numbers (MAXNODES);

vi opr (MAXNODES , 0) ;

bool visited2 [50+1];



void left_rotate_by_one(int arr[], int n)

{



/* Shift operation to the left */

    int temp = arr[0], i;

    for (i = 0; i < n - 1; i++)

        arr[i] = arr[i + 1];

    arr[i] = temp;

}



void array_left_rotate(int arr[], int no_of_rotations, int n)

{

    for (int i = 0; i < no_of_rotations; i++)

        left_rotate_by_one(arr, n);   // Function is called for no_of_rotations times

}



int gcd(int a, int b){

    if (a == 0)

        return b;

    return gcd(b % a, a);

}





// Function to return LCM of two numbers

int lcm(int a, int b)

{

    return (a*b)/gcd(a, b);

}

void addedges (int v , int u  ){

    edges2[u].insert(v);

    edges2[v].insert(u);

} ;

int dfs(int node, int parent , int a[] , int m , int accm ){

    accm = a[node-1]==1? ++accm : 0 ;

    if (accm>m)

        return 0 ;

    int result = ((int)edges[node].size() == 1 && node != 1) ;

    for (int adj : edges[node]) {

        if (adj == parent)

            continue;

        result += dfs(adj, node, a, m, accm);

    }



    return result ;

}

void leaf (vector<vi> edges , int n ){

    int size ;

    int i = 0 ;

    for (vi x : edges ){

        if (i>=n+1)

            break ;

        if (x.size() == 1 && i>1)

            leafs.PB(i);

        i++;

    }

}



int height(int node , int parent ){

    int h = 0 ;

    for(int adj : edges[node]){

        h = max(h,1+height(adj, parent));

    }

    return h ;

}

string recurse (int n , string s , char c) {

    string res = "";

    if (n==0)

        return s+(--c) ;

    else {

        for (int i = 0; i < n / 2; i++) {

            res += c;

        }

        c++;

        n=n/2 ;

        s+= res+recurse(n , s , c);

    }

    return s ;

}

//Brute Force exponential complexity

int bruteforce (int n ){ // possible solutions must be represented as bits 000 , 001 , 010,011 ...

for (int mask = 0 ; mask <(1<<n) ; mask++){

    loop(i,n){ // to know the positions of the items i should take , bitwise and with (1<<i)

        if(mask & (1<<i))

        {

// i will take the position i

        }





    }

}

}

char a[1000+2][1000+2];

long v[101];

int n,k;

long long dp[1000+2][1000+2];

 long long solve (int i , int j ) {

    if (a[i][j]=='#')

        return 0 ;

    if (i==n || j==k)

        return 0 ;

    if (i == n-1 && j == k-1 )

        return 1;

    if (dp[i][j]!=-1)

        return dp[i][j] ;

    return dp[i][j]= ((solve(i+1, j)%((int)1e9+7))+ (solve(i, j+1)%((int)1e9+7)))%(int(1e9+7));

    }



long long fib(int x){

    if (x==0)

        return 0;

        if (x==1)

            return 1 ;



}



int main () {

    ios_base::sync_with_stdio(false);

    cin.tie(0);

    cout.tie(0);

 //  freopen ("input.txt","r",stdin);

   // freopen ("output.txt","w",stdout);





    cin>>n>>k;

    loop(i,n){

        loop(j,k){

            cin>>a[i][j];

        }

 }

    for (int i = 0; i < n; i++)

        for (int j = 0; j <= k; j++)

            dp[i][j]= -1;

 cout<<solve(0,0);

}


// Faster C++ solution for the same problem (measured speedup: 2.1012270120445806x):
#include<bits/stdc++.h>

#define f(i,s,v) for(int i=(int)s;i<(int)v;++i)

#define rf(i,s,v) for(int i=(int)s-1;i>(int)v;--i)

#define pb push_back

#define all(v) ((v.begin()),(v.end()))

#define memset(c, value) memset(c, (int)value, sizeof(c))

using namespace std;

typedef long long ll;

const int oo = 1e9+5;

const ll MOD =1e9+7;

const double pi = acos(-1);

void fast(){

    ios_base :: sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);

}

int n, m;

bool valid (int r,int c){

    return (r < n && r >= 0 && c >= 0 && c < m);

}



int row[] = {0 , 1 , 0, -1};

int column[] = {1 , 0, -1, 0};



char a[1001][1001];

int dp[1001][1001];



int path(int r, int c){

    if(!valid(r, c) || a[r][c] == '#')

        return 0;

    if(r == n-1 && c == m-1)

        return 1;



    int &ret = dp[r][c];

    if(ret != -1) return ret;



    ret = 0;



    return ret = (ret + path(r+1, c)%MOD + path(r, c+1)%MOD)%MOD;

}



int main()

{

    fast();



    cin>>n>>m;

    f(i, 0, n)

    f(j, 0, m)

        cin>>a[i][j];

    memset(dp, -1);

    cout<<path(0,0)<<'\n';



    return 0;

}