Mady has an infinite number of balls and empty boxes available to her. The empty boxes, each capable of holding four balls, are arranged in a row from left to right. At the first step, she places a ball in the first box of the row. At each subsequent step, she places a ball in the first box of the row that still has room for a ball and empties any previous boxes. How many balls in total are in the boxes as a result of Mady's 2010th step?
This would involve modular arithmetic but not sure how to solve it. Any idea appreciated. Thanks!