1. A person is located at the point $(1,1)$ in the coordinate plane and wishes to find an object located at one of the points $(a, b)$, where $a \in\{1,2, \ldots, m\}$, $b \in\{1,2, \ldots, n\}$, and then return to the point from which they started. How much time is required to complete the task if they do not know in which of the given points the object is located and can move in any direction at a speed not exceeding 1.
1. A person must visit each of the points $(a, b)(1 \leqslant a \leqslant m, 1 \leqslant b \leqslant n)$, so they must take at least $m n$ steps of length at least 1.

For example, if $n$ is even, the person can achieve this by following a path of exactly length $mn$ (as shown in the figure).

On the other hand, if both $m$ and $n$ are odd, with each move to an adjacent point, the person changes the parity of the sum of the coordinates of their position. Since they need to return to the starting point after an odd number of steps, they must take at least one step to a non-adjacent point, thus making a step of length at least $\sqrt{2}$. Therefore, the total path length

$2 \mid n:$ is not shorter than $m n+\sqrt{2}-1$. In the figure,

![](https://cdn.mathpix.com/cropped/2024_06_04_5c2360d38eadf7ec6f9bg-3.jpg?height=179&width=306&top_left_y=710&top_left_x=1252)

$2 \nmid m n$ :

![](https://cdn.mathpix.com/cropped/2024_06_04_5c2360d38eadf7ec6f9bg-3.jpg?height=186&width=345&top_left_y=912&top_left_x=1255)
it is shown that this length can also be achieved.