4. A group of 17 middle school students went to several places for a summer social survey, with a budget for accommodation not exceeding $x$ yuan per person per day. One day, they arrived at a place with two hostels, $A$ and $B$. $A$ has 8 first-class beds and 11 second-class beds; $B$ has 10 first-class beds, 4 second-class beds, and 6 third-class beds. It is known that the daily rates for first-class, second-class, and third-class beds are 14 yuan, 8 yuan, and 5 yuan, respectively. If the entire group stays in one hostel, they can only stay at $B$ according to the budget. Then the integer $x=$ $\qquad$.
4. $x=10$.

If staying at location $A$, even choosing the most economical beds, the average accommodation cost per person will exceed 10 yuan (since $8 \times 11 + 14 \times 6 = 172$ (yuan), $172 \div 17 \approx 10.12$ (yuan)).

If staying at location $B$, with a reasonable choice of beds, the budget can be met, and the most economical value is
$$
\begin{array}{l}
5 \times 6 + 8 \times 4 + 14 \times 7 = 160 \text{ (yuan) }, \\
160 \div 17 \approx 9.41 \text{ (yuan). }
\end{array}
$$

Since $9.41 \leqslant x < 10.12$, and $x$ is an integer, therefore, $x = 10$.