5. Let positive integers $a, b, c, d$ satisfy $a>b>c>d$, and $a+b+c+d=2004, a^{2}-b^{2}+c^{2}-d^{2}=2004$. Then the minimum value of $a$ is $\qquad$ .
5. 503. From the given conditions, we know: \(a-b \geqslant 1, c-d \geqslant 1\), thus \(2004=(a+b)(a-b)+(c+d)(c-d) \geqslant(a+b)+(c+d)=2004\), so \(a-b=1, c-d=1\). Also, \(a-c \geqslant 2\), hence \(2004=a+b+c+d=a+(a-1)+c+(c-1)=2a+2c-2 \leqslant 2a+2(a-2)-2=4a-6\), thus \(a \geqslant \frac{2010}{4}>502\), therefore \(a \geqslant 503\). When \(a=503, b=502\), \(c=500, d=499\), the conditions are satisfied, so the minimum value of \(a\) is 503.