4. Given several real numbers (which can be the same) belonging to the interval $[0,1]$ whose sum does not exceed $S$. Find the maximum value of $S$ such that these numbers can always be divided into two groups, each with a sum not exceeding 9.
4. The maximum value of $S$ is 17.1.

First, prove that $S>17.1$ does not meet the problem's requirements.
In fact, when $S>17.1$, take
$$
S=17.1+19 \varepsilon(\varepsilon>0) \text {. }
$$

Suppose we are given 19 numbers, all equal to $0.9+\varepsilon$, then clearly there is at least one group of numbers with no fewer than 10 numbers, whose sum is not less than $9+10 \varepsilon>9$, which does not meet the problem's requirements.

Next, prove that when $S \leqslant 17.1$, for any $S$, the problem's requirements are satisfied.

Consider some numbers among the given numbers, whose sum is $S_{1}$, and $89$.
Discuss in two cases.
(1) $A \geqslant 8$. 1 .
Then the sum of the remaining numbers does not exceed 9, and they can be divided into two groups with sums of $A$ and $S-A$, respectively, meeting the problem's requirements.
(2) $A9$, and $A=8.1-x$, so,
$$
\begin{array}{l}
a>0.9+x . \\
\text { Hence } S-A \geqslant 10(0.9+x)=9+10 x \text {. } \\
\text { But } S \geqslant A+9+10 x \\
=8.1-x+9+10 x \\
=17.1+9 x>17.1,
\end{array}
$$

Contradiction.
Thus, the remaining numbers do not exceed nine.
Therefore, the maximum value that $S$ can take is 17.1.