#dph. [dp_h]Grid 1
[dp_h]Grid 1
Problem Statement
There is a grid with horizontal rows and vertical columns. Let denote the square at the -th row from the top and the -th column from the left.
For each and (, ), Square is described by a character . If is .
, Square is an empty square; if is #
, Square is a wall square. It is guaranteed that Squares and are empty squares.
Taro will start from Square and reach by repeatedly moving right or down to an adjacent empty square.
Find the number of Taro's paths from Square to . As the answer can be extremely large, find the count modulo .
Constraints
- and are integers.
- is
.
or#
. - Squares and are empty squares.
Input
Input is given from Standard Input in the following format:
Output
Print the number of Taro's paths from Square to , modulo .
Sample Input 1
Sample Output 1
There are three paths as follows:
Sample Input 2
Sample Output 2
There may be no paths.
Sample Input 3
Sample Output 3
Sample Input 4
Sample Output 4
Be sure to print the count modulo .