#abc232d. [abc232_d]Weak Takahashi
[abc232_d]Weak Takahashi
Problem Statement
There is a -square grid with horizontal rows and vertical columns. Let denote the square at the -th row from the top and -th column from the left.
Each square is described by a character , where .
means is an empty square, and #
means is a wall.
Takahashi is about to start walking in this grid. When he is on , he can go to or . However, he cannot exit the grid or enter a wall square. He will stop when there is no more square to go to.
When starting on , at most how many squares can Takahashi visit before he stops?
Constraints
- and are integers.
-
.
or#
. -
.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
3 4
.#..
..#.
..##
Sample Output 1
4
For example, by going $(1, 1) \\rightarrow (2, 1) \\rightarrow (2, 2) \\rightarrow (3, 2)$, he can visit squares.
He cannot visit or more squares, so we should print .
Sample Input 2
1 1
.
Sample Output 2
1
Sample Input 3
5 5
.....
.....
.....
.....
.....
Sample Output 3
9