3. The sum of the first 1997 terms of the sequence $1,1,2,1,2,3,1,2,3,4,1,2 \cdots$ is $\qquad$ .
3.42654 .

Sequence grouping: Let $a_{1997}$ be in the $(k+1)$-th group. (1), (1,2), (1,2,3), ..., (1,2,...,k), (1,2,..., $a_{1997}$, ..., k+1). From the sum of terms, we have
$$
\left\{\begin{array}{l}
1+2+\cdots+k=\frac{k(k+1)}{2}<1997, \\
1+2+\cdots+(k+1)=\frac{(k+1)(k+2)}{2} \geqslant 1997 .
\end{array}\right.
$$

Solving this, we get $k=62$. Therefore, $a_{1997}$ is in the 63rd group.
Since $1997-\frac{62 \times 63}{2}=44$, then $a_{1997}=44$.
$$
\begin{aligned}
S_{1997}= & \sum_{k=1}^{62} \frac{k(k+1)}{2}+(1+2+\cdots+44) \\
= & \frac{1}{2}\left[1^{2}+2^{2}+\cdots+62^{2}+1+2+\cdots+62\right] \\
& +\frac{44 \times 45}{2}=42654 .
\end{aligned}
$$