A8. In my desk, the number of pencils and pens was in the ratio $4: 5$. I took out a pen and replaced it with a pencil and now the ratio is $7: 8$. What is the total number of pencils and pens in my desk?
Solution
45
As the original ratio of the number of pencils to the number of pens was $4: 5$, let the original number of pencils be $4 x$. Then the original number of pens was $5 x$. When a pen is replaced with a pencil, the ratio of pencils to pens becomes $7: 8$. Therefore
$$
\begin{aligned}
\frac{4 x+1}{5 x-1} & =\frac{7}{8} \\
\Rightarrow 7(5 x-1) & =8(4 x+1) \\
\Rightarrow 35 x-7 & =32 x+8 \\
\Rightarrow 3 x & =15 \\
\Rightarrow x & =5 .
\end{aligned}
$$

Therefore, the total number of pencils and pens in my desk is $4 \times 5+5 \times 5=45$.