using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
using Pair = System.Tuple<int, int>;
using Edge = System.Tuple<int, int, long>;
//using Debug;
//using static System.Globalization.CultureInfo;

class Program
{
    static void Main(string[] args)
    {
        var hw = Input.ar;
        var gred = Input.gred(hw[0]);
        var dp = new long[hw[0], hw[1]];
        var Hg = new[] { 0, 1, 0, -1 };
        var Wg = new[] { 1, 0, -1, 0 };
        var th = new bool[hw[0], hw[1]];
        var que = new Queue<Pair>();
        que.Enqueue(new Pair(0, 0));
        dp[0, 0] = 1;
        while (que.Count != 0)
        {
            var p = que.Dequeue();
            for(var i = 0; i < 4; i++)
            {
                var h = Hg[i] + p.Item1;
                var w = Wg[i] + p.Item2;
                if (!Search.IsInside(h, w, hw)) continue;
                if (!th[h, w] && i < 2 && gred[h][w] == '.')
                {
                    th[h, w] = true;
                    que.Enqueue(new Pair(h, w));
                }
                else if (i >= 2) dp[p.Item1, p.Item2] = (dp[p.Item1, p.Item2] + dp[h, w]) % Input.MOD;
            }
        }
        WriteLine(dp[hw[0] - 1, hw[1] - 1]);
    } 
}

public class Input
{
    public static string read => ReadLine();
    public  static int[] ar => Array.ConvertAll(read.Split(' '), int.Parse);
    public  static int num => ToInt32(read);
    public static long[] arL => Array.ConvertAll(read.Split(' '), long.Parse);
    public  static long numL => ToInt64(read);
    public static string[] gred(int h) 
        => Enumerable.Repeat(0, h).Select(v => read).ToArray();
    public static int[][] twodim(int num)
        => Enumerable.Repeat(0, num).Select(v => ar).ToArray();
    public static long[][] twodimL(int num)
        => Enumerable.Repeat(0, num).Select(v => arL).ToArray();
    public const long Inf = (long)1e18;
    public const double eps = 1e-11;
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}

public class Search
{
    public static int UpperBound<T>(T[] array,T value)
        where T:IComparable<T>
    {
        var low = 0;
        var high = array.Length;
        while (high > low)
        {
            var mid = (high + low) / 2;
            if (array[mid].CompareTo(value) == 1) high = mid;
            else low = mid + 1;
        }
        return low;
    }

    public static int LowerBound<T>(T[] array,T value)
        where T : IComparable<T>
    {
        var low = 0;
        var high = array.Length;
        while (high > low)
        {
            var mid = (high + low) / 2;
            if (array[mid].CompareTo(value) != -1) high = mid;
            else low = mid + 1;
        }
        return low;
    }

    public static T Max<T>(params T[] array)
        => array.Max();
    public static T Min<T>(params T[] array)
        => array.Min();
    public static bool IsInside(int h, int w, int[] hw)
        => 0 <= h && h < hw[0] && 0 <= w && w < hw[1];
    public static bool IsPrime(long num)
    {
        if (num % 2 == 0 || num == 1) return false;
        for (var i = 3; i * i <= num; i += 2)
            if (num % i == 0) return false;
        return true;
    }
}


Measured memory_bytes: 28492