h,w = gets.split.map(&:to_i)
field = Array.new(h+2).map{Array.new(w+2, "#")}
for i in 1..h
  field[i] = gets.chomp.split("")
  field[i].push("#")
  field[i].insert(0,"#")
end
dp = Array.new(h+2).map{Array.new(w+2, 0)}
for i in 1..h
  for j in 1..w
    if i == 1 && j == 1
      dp[i][j] = 1
    else
      if field[i][j] == "."
        dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % (10**9 + 7)
      else
        dp[i][j] = 0
      end
    end
  end
end
puts dp[h][w]
