24. Let pentagon $A B C D E$ be a cyclic pentagon, $A B=$ $C D=3, B C=D E=10, A E=14$, the sum of the lengths of all diagonals is $\frac{m}{n}\left(m, n \in \mathbf{Z}_{+},(m, n)=1\right)$. Then $m+n=$ ( ).
(A) 129
(B) 247
(C) 353
(D) 391
(E) 421
24. D.

As shown in Figure 3, from the given conditions, we know that quadrilaterals $ABCD$ and $BCDE$ are both isosceles trapezoids.
Thus,
$$
\begin{array}{c}
AC=BD=CE. \\
\text{Let } AC=BD=CE \\
=x, AD=y, BE=z.
\end{array}
$$

By Ptolemy's theorem, we have
$$
\begin{array}{l}
\left\{\begin{array}{l}
x^{2}=10 y+9, \\
x^{2}=3 z+100, \\
y z=14 x+30
\end{array}\right. \\
\Rightarrow \frac{x^{2}-9}{10} \times \frac{x^{2}-100}{3}=14 x+30 \\
\Rightarrow x^{3}-109 x-420=0 \\
\Rightarrow(x-12)(x+5)(x+7)=0 \\
\Rightarrow x_{1}=12, x_{2}=-5, x_{3}=-7.
\end{array}
$$

Since $x>0$, then $x=12$.
Thus, $y=\frac{27}{2}, z=\frac{44}{3}, 3 x+y+z=\frac{385}{6}$.
Therefore, $m+n=385+6=391$.