A new way to find sum of numbers formed by given digits? I recently came across this question:

*

*$Find \  the \ sum \ of \ 5-digit \ numbers \ that \ can \ be \ formed \ using \ 0,0,1,2,3,4.$
I had no proper strategy to solve this question. So I decided to form a strategy of my own.
After spending hours on this, with the help of couple of examples and their solutions, I came to establish something like this:
$ Some \ of \ n-digit \ numbers \ formed \ by \ the \  digits $ $$x, x ,..., y, y,..z,z,,..$$
$= (no. \  of \ digits   \ given - 1)!  (x+x+...+y+y...+z+z)(1111... n \ times)(\frac{1}{a!b!..}) \ $.
Where $a, b, ... $ are the no. of times each digit is repeated.
And, if one of the digit is $0$, the formula still seems to work with a bit of change.
If there's, say, $m$ zeroes, then we have:
Sum of digits
$ = \  (no. \ of \ digits \  given - 1)!(x+x+...+y+y...+z+z)(1111... n \ times)(\frac{1}{a!b!...m!}) - (no. \ of \ digits  \  given -2)!(x+x+...+y+y...+z+z+...)(1111...n-1 \ times)(\frac{1}{a!b!...(m-1)!}) $
I tried applying this to some questions including the one mentioned above, and it worked every time. I was so relieved that I found something new and interesting.
Then I came across this question:

*

*Find the sum of all three digit numbers that can be formed by using the digits $ 0, 1, 2, 3, 4.$
I applied the same formula here as well ( though the question is simpler and can be done otherwise), but this time the formula seems to betray me.
Can anyone say why?
Can this be extended further to even complicated questions?
And, is what I mentioned above a logical and relevant formula?
Thanks.
Note: There was a small error in the post. Instead of $n!$ and $n-1$ it is actually $ (no. \ of \ digits \  given - 1)!$ and $(no. \ of \ digits \  given - 2)!$, respectively.
 A: First of all , i could not understand your method ,so i do not know whether or not there is any approach like yours in mathematics .
However , i can give you formal method for this types of questions. When you encounter with this types of question , you should find how many possible number there are for each decimal by using numbers in given set.For example , there are $60$ different numbers of lenght $5$ with starting $1$ in the set of $\{0,0,1,2,3,4\}$. Moreover, it is valid for the numbers of lenght $5$ starting with $2$ or $3$ or $4$.
This means that when we sum them we will have $(60 \times 10000)+(60 \times 20000)+(60 \times 30000)+(60 \times 40000)=6,000,000$ by the first digits.
This can be applied to all digits respectively. However , be careful when you arrange them , do not forget that fist digits cannot be zero.
What is more, for advanced question  ,you can use "$\color{blue}{exponential}$ generating functions " to construct $n$-digit number . I am putting here some links may help you about this topic :
write five digits numbers using $0,0,0,1,1,2,2,2,2,3,3,3,4,4$.
What is the sum of the all possible $6$ digits numbers which are chosen in the set of {$0,0,0,1,2,3,4,5,6,7,8$}
