12. For a circle $O$ with radius $R$ and a line $l$ outside the circle, the projection of $O$ on $l$ is $H$, and $OH=d$. $OH$ intersects the circle $O$ at points $C$ and $D$, with $CH > DH$. Let $P$ and $Q$ be points on $l$ such that $P$ and $Q$ are on the same side of $H$, and $PH=a$, $QH=b$, with $a > b$. In the circle $O$, there are 2008 chords $A_{i} B_{i} (i=1,2, \cdots, 2008)$ parallel to $l$, and these 2008 chords intersect $CD$ at points that divide $CD$ equally. Then, the value of $\frac{1}{2008} \sum_{i=1}^{2008}\left(P A_{i}^{2}+P B_{i}^{2}+Q A_{i}^{2}+Q B_{i}^{2}\right)$ is (expressed in terms of $a, b, d, R$) $\qquad$ -
Answer $2 a^{2}+2 b^{2}+4 d^{2}+4 R^{2}$.

Let the midpoint of $A_{i} B_{i}$ be $M_{i}$, and the midpoint of $P Q$ be $N$. By the median formula, we have
$$
P A_{i}^{2}+P B_{i}^{2}+Q A_{i}^{2}+Q B_{i}^{2}=P Q^{2}+A_{i} B_{i}^{2}+4 M_{i} N^{2}=(a-b)^{2}+A_{i} B_{i}^{2}+4 M_{i} N^{2}.
$$

Since $M_{i}$ lies on $C H$, let $O M_{i}=x_{i}$,
where $x_{i}$ is positive when $M_{i}$ is on $O D$ and negative when $M_{i}$ is on $O C$.
Then, $A_{i} B_{i}^{2}+4 M_{i} N^{2}=A_{i} B_{i}^{2}+4\left(H N^{2}+M_{i} H^{2}\right)=4\left(R^{2}-x_{i}^{2}\right)+4\left(\left(\frac{a+b}{2}\right)^{2}+\left(d-x_{i}\right)^{2}\right)$
$$
=(a+b)^{2}+4 R^{2}+4 d^{2}-8 d x_{i}.
$$

Since $\sum_{i=1}^{2008} x_{i}=0$, therefore $\frac{1}{2008} \sum_{i=1}^{2008}\left(P A_{i}^{2}+P B_{i}^{2}+Q A_{i}^{2}+Q B_{i}^{2}\right)=2 a^{2}+2 b^{2}+4 d^{2}+4 R^{2}$.
Note $P A_{i}^{2}+P B_{i}^{2}+Q A_{i}^{2}+Q B_{i}^{2}=P Q^{2}+A_{i} B_{i}^{2}+4 M_{i} N^{2}$ is Euler's theorem.