#K82967. Maze Path Counting
Maze Path Counting
Maze Path Counting
Jack and Jill are participating in a treasure hunt in a maze represented by a grid of n rows and m columns. Each cell in the maze is either open (denoted by '.') or blocked (denoted by '#'). Starting from the top-left cell (1,1), they can only move right or down to reach the bottom-right cell (n, m) while avoiding blocked cells.
Your task is to calculate the number of distinct paths from the top-left corner to the bottom-right corner. Since the number of paths can be very large, output the result modulo \(10^9+7\).
Note that you can only move right or down at each step.
inputFormat
The first line contains two space-separated integers, n and m, representing the number of rows and columns of the maze. Each of the next n lines contains a string of m characters, representing a row of the maze. Each character is either '.' (an open cell) or '#' (a blocked cell).
outputFormat
Output a single integer which is the number of distinct paths from the top-left to the bottom-right corner modulo (10^9+7).## sample
3 3
...
.#.
...
2