Question:
A box can fit exactly 8 large cubes, 64 medium cubes, or 512 small cubes. 3 large cubes, 32 medium cubes and some small cubes are put into such a box. What is the greatest possible number of small cubes that can fit into the box?

Solution:
