import Data.Array.Unboxed
import Data.Array.IO
import Control.Monad

type Memo = IOUArray (Int,Int) Int
type Grid = UArray (Int,Int) Char

solve :: Grid -> Memo ->  IO ()
solve grid memo = do
    let (_,(maxh,maxw)) = bounds grid
    forM_ [1..maxh] $ \i -> 
        forM_ [1..maxw] $ \j -> do
            curr <- readArray memo (i,j)
            forM_ [(i+1,j),(i,j+1)] $ \n@(ny,nx) ->
                when (ny <= maxh && nx <= maxw) $ do
                    let g = grid ! n
                    rd <- readArray memo n
                    when (g == '.') $ writeArray memo n $ (curr+rd) `rem` (10^9+7)

main = do
    [h,w] <- map read . words <$> getLine :: IO [Int]
    str <- concat <$> replicateM h getLine :: IO String
    let grid = listArray ((1,1),(h,w)) str :: Grid
    memo <- newArray ((1,1),(h,w)) 0 :: IO Memo
    writeArray memo (1,1) 1
    solve grid memo
    readArray memo (h,w) >>= print