h, w = gets.split.map(&:to_i)

a = Array.new(h+1) {Array.new(w+1, ?#)}
1.upto(h) do |i|
    gets.chomp.each_char.with_index(1) {|c,j| a[i][j] = c}
end

d = Array.new(h+1) {Array.new(w+1, 0)}
d[0][1] = 1
1.upto(h) do |i|
    1.upto(w) do |j|
        d[i][j] = d[i-1][j] + d[i][j-1] if a[i][j] == ?.
    end
end

p d[h][w] % (10 ** 9 + 7)