m, n = gets.split.map(&:to_i)
grid = m.times.map { gets.chomp }
  dp = Array.new(m, 0) { Array.new(n, 0) }
  dp[0][0] = 1
    
  (0...m).each do |i|
    (0...n).each do |j|
      next if grid[i][j] == '#'
      dp[i][j] = dp[i-1][j] + dp[i][j-1] if dp[i][j] == 0
      dp[i][j] %= 10**9 + 7
    end
  end
  puts dp[m-1][n-1]