atcoder#DPH. Grid 1
Grid 1
Score : points
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 .
3 4
...#
.#..
....
3
There are three paths as follows:
5 2
..
#.
..
.#
..
0
There may be no paths.
5 5
..#..
.....
#...#
.....
..#..
24
20 20
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
345263555
Be sure to print the count modulo .