H,W = gets.split.map &:to_i
S = (0...H).map{ gets.chomp.split("") }
Mod = 1e9.to_i+7
dp = (0...H).map{ Array.new(W,0) }
dp[0][0] = 1
(0...H).each{ |i|
  sh = S[i-1]
  si = S[i]
  dph = dp[i-1]
  dpi = dp[i]
  (0...W).each{ |j|
    if i > 0 && sh[j] == "."
      dpi[j] = (dpi[j] + dph[j]) % Mod
    end
    if j > 0 && si[j-1] == "."
      dpi[j] = (dpi[j] + dpi[j-1]) % Mod
    end
  }
}
#p dp
p dp[-1][-1]