H, W = gets.split.map(&:to_i)
A = H.times.map { gets.chomp }

dp = Array.new(H) { Array.new(W, 0) }
dp[0][0] = 1

WALL = '#'.freeze
MOD = 10**9 + 7

H.times do |h|
  W.times do |w|
    next if A[h][w] == WALL

    dp[h][w] += dp[h][w - 1] if w > 0
    dp[h][w] += dp[h-1][w] if h > 0
    dp[h][w] %= MOD
  end
end

puts dp[H-1][W-1]
