8. The terms of a sequence are all 3 or 5, the first term is 3, and there are $2^{k-1}$ fives between the $k$-th 3 and the $(k+1)$-th 3, i.e., $3,5,3,5,5,3,5,5,5,5,3, \cdots$. Then the sum of the first 2004 terms of this sequence $S_{2004}=$ $\qquad$ .
8. 9998 .

The $k$-th 3 and the $2^{k-1}$ 5s following it, totaling $\left(2^{k-1}+1\right)$ terms, are considered as one group. Suppose the 2004th term is in the $k$-th group, then $k$ is the smallest positive integer satisfying
$$
k+1+2+\cdots+2^{k-1} \geqslant 2004
$$

It is easy to find that $k=11$.
Thus, $S_{2004}=5 \times 2004-2 \times 11=9998$.