Five. (This question is worth 15 points)
There is a rectangular prism with length, width, and height being positive integers $m, n, r$ $(m \leqslant n \leqslant r)$, respectively. After being painted red, it is cut into unit cubes with edge length 1. It is known that the number of unit cubes without any red faces plus the number of unit cubes with exactly two red faces, minus $r$, equals a certain value.
From $m \leqslant n \leqslant r$ we know $\quad m-4 \leqslant n-4 \leqslant r-4$.
$$
\therefore m-4=1, n-4=3, r-4=659 \text {. }
$$

Thus, $m=5, n=7, r=663$.
Similarly, from $1977=1 \times 1 \times 1977$ we know
$$
m-4=1, n-4=1, r-4=1977 \text {, }
$$

Thus, $m=5, n=5, r=1981$.
$\therefore$ The sets of $m, n, r$ that satisfy the conditions are:
$$
\left\{\begin{array}{l}
m_{1}=5, n_{1}=7, r_{1}=663 ; \\
m_{2}=5, n_{2}=5, r_{2}=1981 .
\end{array}\right.
$$

Solution: According to the problem, the number of cubes without red faces is:
$$
(m-2)(n-2)(r-2) \text {. }
$$

The number of cubes with one red face is:
$$
\begin{aligned}
2(m-2)(n-2)+2(m-2)(r-2) \\
+2(n-2)(r-2) .
\end{aligned}
$$

The number of cubes with two red faces is:
$$
4(m-2)+4(n-2)+4(r-2) \text {. (6 points) }
$$

Thus, we have
$$
\begin{array}{c}
(m-2)(n-2)(r-2)+4[(m-2) \\
+(n-2)+(r-2)]-2[(m-2)(n-2) \\
+(m-2)(r-2)+(n-2)(r-2)]=1985
\end{array}
$$
$$
\begin{array}{l}
\text { i.e., }[(m-2)-2][(n-2)-2][(r-2)-2] \\
+8=1985 .
\end{array}
$$
$$
\therefore(m-4)(n-4)(r-4)=1977=1 \times 3 \times 659 \text {. }
$$