25. Let $S$ be a set of points on the coordinate plane. The coordinates of the points in $S$ are integers between $1 \sim 30$, and there are exactly 300 points in $S$ that lie below or on the line $y=m x$, where $m$ is a fraction $\frac{a}{b}\left(a, b \in \mathbf{Z}_{+},(a, b)=1\right)$. Then the value of $a+b$ is ( ).
(A) 31
(B) 47
(C) 62
(D) 72
(E) 85
25. E.

It is known that the number of integer points below or on the line $y=m x$ is $\sum_{i=1}^{30}\lfloor m i\rfloor$ (where $\lfloor x\rfloor$ is the smallest integer not less than the real number $x$).

Given $|S|=30 \times 30=900, \sum_{i=1}^{30}\lfloor m i\rfloor=300$, we first assume the line $y=m x$ passes through the point $(30,20)$, and take the estimated value $m=\frac{2}{3}$.
Notice,
$$
\begin{array}{l}
\sum_{i=1}^{30}\left\lfloor\frac{2}{3} i\right\rfloor=\left\lfloor\frac{2}{3}\right\rfloor+\left\lfloor\frac{4}{3}\right\rfloor+\cdots+\left\lfloor\frac{60}{3}\right\rfloor \\
=0+1+2+2+3+4+4+4+\cdots+19+20 \\
=1+2+\cdots+20+2+4+6+\cdots+18 \\
=\frac{20 \times 21}{2}+\frac{2+18}{2} \times 9 \\
=300 .
\end{array}
$$

If $m<\frac{2}{3}$, the point closest to the line $y=\frac{2}{3} x$ above it is $(28,19)$.
We then estimate $m=\frac{19}{28}$.
Then $\sum_{i=1}^{30}\left\lfloor\frac{19}{28} i\right\rfloor=301>300$.
Thus, $m \in\left[\frac{2}{3}, \frac{19}{28}\right)$.
Therefore, the length of the interval for $m$ is $\frac{19}{28}-\frac{2}{3}=\frac{1}{84}$.
Hence, $a+b=1+84=85$.