142. Given a regular $n$-sided prism. The area of the base is $S$. Two planes intersect all the lateral edges of the prism in such a way that the volume of the part of the prism between the planes is $V$. Find the sum of the lengths of the segments of the lateral edges of the prism, enclosed between the planes, if it is known that the planes do not have common points inside the prism.
142. Let the base of the prism be a polygon $A_{1} A_{2} \ldots \ldots A_{n}$, and $a$ be the center of the circle circumscribed around it. Let a plane intersect the edges of the prism at points $B_{1}, B_{2}, \ldots, B_{n}$, and let $M$ be a point in the plane such that the line $MO$ is perpendicular to the base plane of the prism. Then the following equalities hold:

$$
\begin{gathered}
\sum_{k=1}^{n}\left|A_{k} B_{k}\right|=n|M O| \\
V=S|M O|
\end{gathered}
$$

where $V$ is the volume of the part of the prism enclosed between the base and the intersecting plane.

Let's prove equality (1). For even $n$, it is obvious. Suppose $n$ is odd. Consider the triangle $A_{k} A_{k+1} A_{l}$, where $A_{l}$ is the vertex farthest from $A_{k}$ and $A_{k+1}$. Let $C_{k}$ and $C_{k}^{\prime}$ be the midpoints of $A_{k} A_{k+1}$ and $B_{k} B_{k+1}$, respectively. Then $\frac{\left|C_{k} O\right|}{\left|O A_{l}\right|}=\cos \frac{\pi}{n}=\lambda$. It is not difficult to prove that

$$
\begin{aligned}
&|M O|=\frac{\left|C_{k} C_{k}^{\prime}\right|+\left|A_{l} B_{l}\right| \lambda}{1+\lambda}= \\
&=\frac{\frac{1}{2}\left(\left|A_{k} B_{k}\right|+\left|A_{k+1} B_{k+1}\right|\right)+\left|A_{l} B_{l}\right| \lambda}{1+\lambda}
\end{aligned}
$$

Summing these equalities for all $k$ (for $k=n$, take 1 instead of $n+1$), we obtain statement (1).

To prove equality (2), consider the polyhedron $A_{k} A_{k+1} O B_{k} B_{k+1} M$. If $V_{k}$ is the volume of this polyhedron, then by Simpson's formula (see problem 15)

$$
\begin{gathered}
V_{k}=\frac{b_{n}}{6}\left(\frac{\left|A_{k} B_{k}\right|+\left|A_{k+1} B_{k+1}\right|}{2} a_{n}+\right. \\
\left.+4 \frac{\left|A_{k} B_{k}\right|+\left|A_{k+1} B_{k+1}\right|+2|M O|}{4} \cdot \frac{a_{n}}{2}\right)= \\
=a_{n} b_{n}\left(\left|A_{k} B_{k}\right|+\left|A_{k+1} B_{k+1}\right|+|M O|\right)= \\
\quad=\frac{S}{3 n}\left(\left|A_{k} B_{k}\right|+\left|A_{k+1} B_{k+1}\right|+|M O|\right)
\end{gathered}
$$

where $a_{n}, b_{n}$ are the side and apothem of the polygon $A_{1} A_{2} \ldots A_{n}$, respectively. Summing these equalities for all $k$, taking into account (1), we obtain equality (2).

It is now easy to conclude that the answer to our 3D problem is the value $\frac{n V}{S}$.