H,W =gets.split.map &:to_i
grid = Array.new(H).map{Array.new(W,"")}
for i in 0...H
  grid[i]=gets.strip.split("")
end
dp = Array.new(H).map{Array.new(W,0)}
dp[0][0]=1
for i in 1...W
  dp[0][i]=grid[0][i]=="#" ? 0 :  dp[0][i-1]
end
for i in 1...H
  dp[i][0]=grid[i][0]=="#" ? 0 :  dp[i-1][0]
end
for i in 1...W
  for j in 1...H
    if grid[j][i]=="."
      dp[j][i]=dp[j-1][i]+dp[j][i-1]
    else
      dp[j][i]=0
    end
  end
end
puts dp[H-1][W-1] %(1000000007)
