By "digits equal 4," do you mean that the digits sum to four?

What you want in that case is to first figure out all possible combinations of digits between 0 and 4 that add up to four: 0004, 0013, 0022, etc. Then for each set, you want the number of ways to order the digits. Add it all up and you have the answer.

Fun problem!