4. Positive integers $a, b, c, d$ satisfy: $1<a<b<c<d<1000$, and $a+d=b+c$, $bc-ad=2004$. Find the number of all such positive integer tuples $(a, b, c, d)$.
4. Let $b=a+x, c=a+y$, then $x<y$, and $d=a+x+y$ (this is obtained from $a+d=b+c$), thus
$$b c-a d=(a+x)(a+y)-a(a+x+y)=x y$$

That is
$$x y=2004$$

Combining $a+x+y<1000$ and $2004=2^{2} \times 3 \times 167$, we know that $(x, y)=(3,668),(4,501),(6,334),(12,167)$.

Accordingly, $1<a<329,1<a<495,1<a<660,1<a<821$. Thus, the number of qualifying arrays is $327+493+658+819=2297$ (groups).