Mom gave Vasya money for 30 pencils. It turned out that the pencil factory was running a promotional campaign in the store: in exchange for a receipt for a set of 20 pencils, they return $25\%$ of the set's cost, and for a receipt for a set of 5 pencils, they return $10\%$. What is the maximum number of pencils Vasya can buy?
Note that $25 \%$ of the cost of 20 pencils is the cost of 5 pencils, and $10 \%$ of the cost of 5 pencils is half the cost of a pencil. It is clear that to get the maximum discount, Vasya should act as follows: as long as he has enough money, he should buy a set of 20 pencils and immediately exchange the receipt; if he does not have enough money for 20 pencils but has enough for 5, he should buy a set of 5 pencils and immediately exchange the receipts; in the worst case, he should buy individual pencils.

Acting in this way, Vasya will first buy a box of 20 pencils and receive the cost of 5 pencils (after which he will have the cost of 15 pencils left). Then he will buy three sets of 5 pencils and receive the cost of 1.5 pencils. With this money, he will be able to buy only one pencil. In total: 36 pencils.

## Answer

36 pencils.