Question 551404
Try the first several steps to understand what is going on here. The numbers 0-4 represent the number of balls in each box:


Step---#
1------10000
2------20000
3------30000
4------40000
5------01000
6------11000
7------21000
8------31000
9------41000
10-----02000
11-----12000
.
.
.
If you know how to count in different bases such as binary or hexadecimal, it shouldn't take long to conclude that the pattern relies entirely on base 5, (except with digits reversed, but the ordering of the digits is irrelevant). 2010 in base 5 is 31020, so the number of balls in the boxes is 3+1+2 = 6.


Tip: If you don't know what "bases" are, keep in mind that the normal counting we do is in base 10. You may want to read the following:
http://en.wikipedia.org/wiki/Base_(exponentiation)