import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import Control.Monad.ST
import Data.Array.ST


readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [h,w] <- getIntList
    grid <- V.fromList <$> replicateM h (VU.fromList <$> getLine)
    print $ solve h w grid

solve h w grid = runST $ do
    arr <- newArray ((-1,-1),(h-1,w-1)) 0 :: ST s (STUArray s (Int,Int) Int)
    writeArray arr (0,0) 1
    forM_ [0..h-1] $ \i -> do
        forM_ [0..w-1] $ \j -> do
            when (i+j /= 0 && grid V.! i VU.! j == '.') $ do
                pi <- readArray arr (i-1,j)
                pj <- readArray arr (i,j-1)
                writeArray arr (i,j) $ (pi + pj) `mod` 1000000007
    readArray arr (h-1,w-1)