Had all 24 boxes be pen boxes, it would be totaled 10*24 = 240 dollars, exceeding 200 dollars by 40 dollars. Hence, I must replace some of 24 pen boxes by more cheaper $5 boxes to zero the difference. By replacing each box, I decrease the difference by $5. So, the number of the $5 box must be= 8. Then the number of the $10 boxes is 24-8 = 16.