Marcus is stuck in a .
for walkable spaces and #
for unwalkable spaces! He is at the top left corner (position
Marcus wants to know the minimum possible cost. Please help him!
Input Specification
The first line will contain the integer
The next .
for a walkable space or #
for an unwalkable space. The first character of the first line will be position
It is guaranteed positions .
).
Output Specification
Output the minimum cost path for Marcus. If there is no path, output -1
.
Constraints
Subtask 1 [25%]
Subtask 2 [75%]
No additional constraints.
Sample Input
6
......
.#....
##.##.
......
.#####
......
Sample Output
78
Explanation For Sample
The minimum cost path consists of moving down
Comments
>:(
every
day
Marcus
strays
further
from
god's
light.
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.