4. Given four positive integers
$a, b, c, d$ satisfy:
$$
a^{2}=c(d+20), b^{2}=c(d-18) \text {. }
$$

Then the value of $d$ is $\qquad$
4. 180 .

Let $(a, b)=t, a=t a_{1}, b=t b_{1}$.
Then $\frac{d+20}{d-18}=\frac{c(d+20)}{c(d-18)}=\frac{a^{2}}{b^{2}}=\frac{a_{1}^{2}}{b_{1}^{2}}$ (simplest fraction).
Let $d+20=k a_{1}^{2}, d-18=k b_{1}^{2}$.
Eliminating $d$ yields
$$
\begin{array}{l}
k\left(a_{1}+b_{1}\right)\left(a_{1}-b_{1}\right)=2 \times 19 \\
\Rightarrow k=2, a_{1}+b_{1}=19, a_{1}-b_{1}=1 \\
\Rightarrow a_{1}=10, b_{1}=9 \\
\Rightarrow d=k a_{1}^{2}-20=180 .
\end{array}
$$

At this point, there exist $a=20, b=18, c=2$ that satisfy the conditions.
Therefore, $d=180$.