1.4. Ali-Baba is in a cave with gold and diamonds. A kilogram of gold costs 20 dinars, and a kilogram of diamonds costs 60 dinars. He has one chest at his disposal. A full chest of gold weighs $200 \mathrm{~kg}$, and a full chest of diamonds weighs $40 \mathrm{~kg}$. The weight of the empty chest is negligible. Ali-Baba can carry $100 \mathrm{~kg}$. How much gold and how much diamonds should Ali-Baba carry to maximize his profit?

## second grade
1.4. Let Ali-Baba carry $x \mathrm{~kg}$ of diamonds and $y \mathrm{~kg}$ of gold.

It is clear that $x$ and $y$ are non-negative real numbers. Due to the limited space in the chest, it follows that $\frac{x}{40}+\frac{y}{200} \leq 1$. Since Ali-Baba cannot carry a load heavier than $100 \mathrm{~kg}$, it follows that $x+y \leq 100$. From this, we get $y \leq 200-5 x, y \leq 100-x$. Therefore, $y \leq 100-x, \quad 0 \leq x \leq 25 ; \quad y \leq 200-5 x, \quad 25 \leq x \leq 40$. Ali-Baba's profit is

$$
\begin{aligned}
& 60 x+20 y \leq 2000+40 x, 0 \leq x \leq 25 \\
& 60 x+20 y \leq 4000-40 x, 25 \leq x \leq 40
\end{aligned}
$$

It follows that Ali-Baba's profit will be the greatest if he carries $25 \mathrm{~kg}$ of diamonds and $75 \mathrm{~kg}$ of gold, and in this case, it will amount to 3000 dinars.

## second grade