Let $k$ be the number of holes in the garden.

\begin{enumerate}
\item ($6$ points): $n = 1, m = 2$;
\item ($9$ points): $n = 1$;
\item ($15$ points): $k = 1, n \cdot m \le 5 \cdot 10^3$;
\item ($22$ points): $n \cdot m \le 5 \cdot 10^3$;
\item ($17$ points): $k = 1$;
\item ($31$ points): without additional restrictions.
\end{enumerate}