4. Arrange the eight numbers $-7, -5, -3, -2, 2, 4, 6, 13$ as $a, b, c, d, e, f, g, h$, such that
$$
(a+b+c+d)^{2}+(e+f+g+h)^{2}
$$

is minimized. Then this minimum value is $\qquad$
4.34.
Let $x=a+b+c+d$. Then
$$
\begin{array}{l}
e+f+g+h=8-x, \\
(a+b+c+d)^{2}+(e+f+g+h)^{2} \\
=x^{2}+(8-x)^{2}=2(x-4)^{2}+32 .
\end{array}
$$

From the known eight numbers, the sum of any four numbers $x$ is an integer and cannot be 4, so we get
$$
\begin{array}{l}
(a+b+c+d)^{2}+(e+f+g+h)^{2} \\
\geqslant 2+32=34,
\end{array}
$$

and when $x=(-3)+(-2)+4+6=5$, the equality holds.
Therefore, the minimum value sought is 34.