using System;
using System.Numerics;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Collections;
namespace debug
{
class main
{
static void Main(string args)
{
//問題クラスを展開
ProgramE a = new ProgramE();
a.main();//実行する
}
}
//ABC183
class ProgramA
{
public void main()
{
//入力
int s = int.Parse(Console.ReadLine());
//sが0未満かどうかで場合分け
if (s < 0)
Console.WriteLine(0);
else
Console.WriteLine(s);
}
}
class ProgramB
{
public void main()
{
//入力
string a = Console.ReadLine().Split();
double sx = double.Parse(a[0]);
double sy = double.Parse(a[1]);
double gx = double.Parse(a[2]);
double gy = double.Parse(a[3]);
//答を出力
Console.WriteLine(sx - (sx - gx) * sy / (sy + gy));
}
}
class ProgramC
{
static long[,] c;
static long z;
static long k;
static long count = 0;
public void main()
{
//入力
string s = Console.ReadLine().Split();
int n = int.Parse(s[0]);
k = long.Parse(s[1]);
c = new long[n, n];
z = new long[n];
//それぞれの経路距離を記録
for (int i = 0; i < n; i++)
{
string a = Console.ReadLine().Split();
for (int j = 0; j < n; j++)
c[i, j] = long.Parse(a[j]);
}
//深さ優先検索
dfs("a", n - 1);
Console.WriteLine(count);
}
static void dfs(string t, int n)
{
if (n == t.Length - 1)
{
long sum = 0;
int flag = 0;
for (int i = 0; i < n; i++)
{
int y = 0;
for (int j = 0; j < t.Length; j++)
{
if (t[j] == (char)(i + 98)) //98は'b'
y++;
}
if (y > 1)
flag = 1;
}
if (flag == 0)
{
t += 'a';
for (int i = 0; i <= n; i++)
{
sum += c[t[i] - 'a', t[i + 1] - 'a'];
}
if (sum == k)
count++;
}
}
else
{
for (char c = 'b'; c < 'b' + n; c++)
dfs(t + c, n);
}
}
}
class ProgramD
{
public void main()
{
//入力
string s = Console.ReadLine().Split();
int n = int.Parse(s[0]);
long w = long.Parse(s[1]);
long c = new long[200001];
for (int i = 0; i < n; i++)
{
string a = Console.ReadLine().Split();
c[int.Parse(a[0])] += long.Parse(a[2]);
c[int.Parse(a[1])] -= long.Parse(a[2]);
}
//累積和で記録
for (int i = 1; i < n; i++)
c[i] += c[i - 1];
//累積和で判断
for (int i = 0; i < n; i++)
{
if (c[i] > w)
{
Console.WriteLine("No");
return;
}
}
//答
Console.WriteLine("Yes");
}
}
class ProgramE
{
public void main()
{
//入力
string[] s = Console.ReadLine().Split(' ');
long H = long.Parse(s[0]);
long W = long.Parse(s[1]);
long mod = 1000000000 + 7;
long[,] maze = new long[H, W];
long[,] dp = new long[H, W];
long[,] x = new long[H, W];
long[,] y = new long[H, W];
long[,] z = new long[H, W];
//ブロックを入れておく
for (int i = 0; i < H; i++)
{
string t = Console.ReadLine();
for (int j = 0; j < W; j++)
{
if (t[j] == '#')
{
maze[i, j] = -1;
}
}
}
//最初は一通り
dp[0, 0] = 1;
//たてよこななめでそれぞれ累積和
for (int i = 0; i < H; i++)
for (int j = 0; j < W; j++)
{
if (i == 0 && j == 0)
continue;
if (maze[i, j] == -1)
continue;
if(j > 0)
x[i, j] = (x[i, j - 1] + dp[i, j - 1]) % mod;
if (i > 0)
y[i, j] = (y[i - 1, j] + dp[i - 1, j]) % mod;
if (i > 0 && j > 0)
z[i, j] = (z[i - 1, j - 1] + dp[i - 1, j - 1]) % mod;
//全経路を累積する
dp[i, j] = (x[i, j] + y[i, j] + z[i, j]) % mod;
}
//答え出力
Console.WriteLine(dp[H - 1, W - 1]);
}
}
}