MOD = 10 ** 9 + 7
h,w = gets.split.map(&:to_i)
dp = Array.new(h+1){[0]*(w+1)}
w.times do |i|
  dp[i][0] = 0
end
dp[0][1] = 1

1.upto(h) do |i|
  l = gets.chomp
  1.upto(w) do |j|
    s = l[j-1]
    dp[i][j] = s == "." ? (dp[i][j-1] + dp[i-1][j]) % MOD : 0
  end
end
p dp[h][w] % MOD