The cashier of the savings bank paid out a sum of money, which is an integer multiple of $50 \mathrm{Ft}$, to a depositor in banknotes. For this, at least 15 banknotes were needed. However, the depositor requested that the largest denomination be 1000 forints. Thus, at least 35 banknotes were required. What amount was paid out?
In the first case, to pay an amount that is a multiple of $50 \mathrm{Ft}$, at least 15 banknotes were required. We can assume that the largest denomination was the $5000 \mathrm{Ft}$ banknote, since the customer requested that the largest denomination be the $1000 \mathrm{Ft}$ note. Furthermore, only the denominations of $500, 100$, and $50 \mathrm{Ft}$ could have been used. The $500 \mathrm{Ft}$ and $50 \mathrm{Ft}$ notes could be used at most once each, and the $100 \mathrm{Ft}$ notes could be used at most 4 times, as the cashier aimed to use the fewest possible banknotes, meaning, for example, two $500 \mathrm{Ft}$ notes would already be exchanged for a $1000 \mathrm{Ft}$ note.

In the second case, only the number of $5000 \mathrm{Ft}$ notes changed, increasing by 20 (from 15 to 35). When a $5000 \mathrm{Ft}$ note is exchanged, the number of banknotes increases by 4, which means there were originally 5 $5000 \mathrm{Ft}$ notes.

The remaining 10 banknotes were from smaller denominations, specifically 1 $500 \mathrm{Ft}$ note, 1 $50 \mathrm{Ft}$ note, 4 $100 \mathrm{Ft}$ notes, and 4 $1000 \mathrm{Ft}$ notes, as the customer received. This totals to $5 \cdot 5000 + 4 \cdot 1000 + 1 \cdot 500 + 4 \cdot 100 + 1 \cdot 50 = 29950 \mathrm{Ft}$.

Based on the work of Ágnes Kovács (Kecskemét, Bányai J. Gymnasium and Secondary School, 8th grade)