module Template where

import Data.List
import Data.Tree
import Data.Array  --変数衝突
import Data.Array.Unboxed
import Data.Array.MArray
import Data.Array.ST
import Data.Graph
--import Data.Vector as V　--変数衝突
import Control.Monad
import Control.Monad.State
import Control.Monad.ST
--import Debug.Trace

type DP s = STUArray s (Int,Int) Int

mod0 :: Int -> Int
mod0 n = mod n 1000000007

dp_i :: DP s -> (Int,Int) -> ST s ()
dp_i dparr (1,1) = writeArray dparr (1,1) 1
dp_i dparr (i,j) = do
  aij  <- readArray dparr (i,j)
  if aij == (-1) then return ()
    else do
      ai1j <- readArray dparr (i-1,j)
      aij1 <- readArray dparr (i,j-1)
      case (ai1j,aij1) of
        (-1,-1) -> return ()
        (x,-1)  -> writeArray dparr (i,j) x
        (-1,y)  -> writeArray dparr (i,j) y
        (x,y)   -> writeArray dparr (i,j) (mod0 $ x+y)


solve :: Int -> Int -> [Int] -> ST s Int
solve h w mat = do
  dparr <- newListArray ((0,0),(h,w)) mat
  forM_ [1..h] $ \i ->
    forM_ [1..w] $ \j -> dp_i dparr (i,j)
  ans <- readArray dparr (h,w)
  return ans

main :: IO ()
main = do
  [h,w] <- map read.words <$> getLine
  mat' <- replicateM h $ do
    row <- getLine :: IO [Char]
    return $ 0 : (map (\x -> if x == '.' then 0 else -1) row)
  let mat = concat mat'
  putStrLn $ show $ runST $ solve h w ((take (w+1) $ repeat 0) ++ mat)
