Problem

Source: 2022 Centroamerican and Caribbean Mathematical Olympiad, P5

Tags: combinatorics, magic



Esteban the alchemist have $8088$ copper pieces, $6066$ bronze pieces, $4044$ silver pieces and $2022$ gold pieces. He can take two pieces of different metals and use a magic hammer to turn them into two pieces of different metals that he take and different each other. Find the largest number of gold pieces that Esteban can obtain after using the magic hammer a finite number of times. $\textbf{Note:}$ If Esteban takes a copper and bronze pieces, then he turn them into a silver and a gold pieces.