How many numbers less than 10000 are there whose sum of the digits is less than or equal to 5?
A+B+C+D≤5
Introducing a dummy variable E,
A+B+C+D+E=5
This is the arrangement of 5 zeroes and 4 ones (the number of plus signs). Answer is 9C4=126.