5. There are two alloys. The first alloy contains $p \%$ impurities, and the second - respectively $q \%$ impurities. Determine the proportion in which these alloys should be combined to obtain a new alloy containing $r \%$ impurities. In your answer, indicate the ratio of the mass of the first alloy to the mass of the second in the form of a decimal, rounding it if necessary to two decimal places.

$p=70, q=5, r=40$.
Answer: 1.17 (exact answer: $\frac{7}{6}$).

Solution. Let the mass of the second alloy be $a$ (kg, g, t, or any other unit of mass), and the mass of the first be $x \cdot a$ (of the same units). Then $x$ is the desired quantity.

According to the problem, the mass of all impurities is $\frac{x a \cdot p}{100}+\frac{a \cdot q}{100}$. On the other hand, this mass is also equal to $\frac{(x a+a) \cdot r}{100}$. Therefore, $\frac{x a \cdot p}{100}+\frac{a \cdot q}{100}=\frac{(x a+a) \cdot r}{100} \Leftrightarrow x \cdot p+q=(x+1) \cdot r \Leftrightarrow x=\frac{r-q}{p-r}$.

Given the numerical values, $x=\frac{40-5}{70-40}=\frac{7}{6} \approx 1.17$.