Three friends Pankrác, Servác, and Bonifác went on a night walk through a natural labyrinth during their vacation. At the entrance, each received a candle and they set off in different directions. All of them successfully navigated the labyrinth, but each took a different path. In the following square grid, their paths are marked. We know that Pankrác never went south and that Servác never went west. How many meters did Bonifác walk in the labyrinth if Pankrác walked exactly $500 \mathrm{~m}$?

(M. Petrová)

![](https://cdn.mathpix.com/cropped/2024_04_17_0d982c5cbb35b07eed65g-1.jpg?height=665&width=1114&top_left_y=787&top_left_x=471)

Idea. Which path did Bonifác definitely not take?
First, we will determine which paths the friends took. For this, we need to know which cardinal directions the individual paths lead to. The path marked by a solid line leads only north and east. The dashed path leads north, east, and west. The dotted path goes in all cardinal directions. The only path that never leads west is the one marked by a solid line - this belongs to Servác. Bonifác certainly did not take this path. Of the remaining two paths, the dashed one does not lead south - so Pankrác must have taken this one. Therefore, Bonifác must have gone along the dotted line.

Pankrác walked 500 m. Now we will calculate how many segments (i.e., sides of the squares in the square grid) he walked:

\[
\begin{aligned}
& 7(\text { east })+2(\text { north })+4(\text { west })+1(\text { north })+6(\text { west })+2(\text { north })+ \\
& +4(\text { east })+1(\text { north })+4(\text { east })+1(\text { north })+7(\text { east })+1(\text { north })=40 .
\end{aligned}
\]

Now let's determine how many segments Bonifác walked:

\[
\begin{aligned}
& 1(\text { west })+1(\text { north })+3(\text { west })+3(\text { north })+3(\text { east })+2(\text { north })+ \\
+ & 1(\text { east })+4(\text { north })+3(\text { east })+3(\text { south })+1(\text { east })+6(\text { south })+ \\
+ & 2(\text { east })+8(\text { north })+2(\text { east })+1(\text { north })+4(\text { east })+2(\text { south })=50 .
\end{aligned}
\]

If 40 segments measure \(500 \text{ m}\), then 10 segments measure \(500: 4=125(\text{ m})\). So, 50 segments measure \(500+125=625(\text{ m})\). Bonifác walked 625 meters in the maze.