Dragon Gorynych finds himself trapped in a labyrinth and wants to escape as quickly as possible. However, after consuming kefir yesterday, his left head isn't functioning well. As a result, Dragon Gorynych can only turn right and move straight; he cannot turn left or make a U-turn. Your task is to help Dragon Gorynych find the shortest path to the labyrinth's exit.
The first line contains the integers and (4 \le r, c \le 20), representing the number of rows and columns in the labyrinth map. Each of the following lines contains characters that describe the map. The character indicates Dragon Gorynych's starting position, marks the exit, and represents a wall. Spaces indicate passable cells. The labyrinth is guaranteed to be enclosed by walls. Before starting, Dragon Gorynych can face any of the directions (up, down, left, or right).
Output a single number representing the distance Dragon Gorynych must travel to reach the exit. It is guaranteed that he will always be able to find a way out of the labyrinth.
Example 1