3. Let $p, q \in \mathbf{N}$, and $1 \leqslant p<q \leqslant n$, where $n$ is a natural number not less than 3. Then the sum $S$ of all fractions of the form $\frac{p}{q}$ is $\qquad$
3. $\frac{1}{4} n(n-1)$.

Notice that
$$
S=\sum_{q=2}^{n} \sum_{p=1}^{q-1} \frac{p}{q}=\sum_{q=2}^{n} \frac{q-1}{2}=\frac{1}{4} n(n-1) .
$$