12.98 Consider a rectangular grid paper of size $m \times n$ where the side length of each cell is 1. Can a broken line be drawn along the grid lines such that it passes through each node inside and on the boundary of the rectangle exactly once? If it can be done, what is the length of the broken line?
[Solution] Construct a broken line as follows: In an $m \times n$ rectangle, there are $m+1$ vertical grid lines. Connect the 1st and 2nd lines along the upper boundary, connect the 2nd and 3rd lines along the lower boundary, and so on, until the last line is connected. Clearly, the broken line obtained in this way meets the requirements of the problem.

For any broken line that meets the requirements, connect all $(m+1) \times (n+1)$ nodes along the broken line, with each adjacent pair of points connected by a line segment of length 1. Therefore, the total length of the broken line is
$$
(m+1) \times (n+1) - 1 = mn + m + n.
$$