12. Given the sequence $\left\{a_{n}\right\}$, where $a_{1}=1, a_{2}=2, a_{n} a_{n+1} a_{n+2}=a_{n}+a_{n+1}+a_{n-2}$, and $a_{n+1} a_{n+2} \neq 1$, then $a_{1}+a_{2}+\cdots+a_{2004}=$ $\qquad$
12. 4008.

Brief solution: The first few terms of the sequence are $1,2,3,1,2,3, \cdots$, so $a_{1}+a_{2}+\cdots+a_{2004}=(1+2+$ 3) $\times \frac{2004}{3}=4008$.