fun main(args: Array<String>) {
    val (H, W) = readLine()!!.split(" "). map { it.toInt() }
    val map = Array(H) { IntArray(W) }
    val dp = Array(H) { IntArray(W) }
    dp[0][0] = 1
    for(i in 0 until H) {
        val s = readLine()!!
        for(j in 0 until W) {
            map[i][j] = if (s[j].toString() == "#") 1 else 0
        }
    }
    for (i in 0 until H) {
        for (j in 0 until W) {
            if (map[i][j] == 1) continue
            if (i == 0 && j == 0) continue

            dp[i][j] = ((if (i != 0) dp[i-1][j] else 0) + (if (j != 0) dp[i][j-1] else 0)) % 1000000007
        }
    }
    println(dp[H-1][W-1])
}