We have "n" dice.

Each have "m" sides.

They are tossed "N" times.

We must assume that the sides are numbered \(\displaystyle 1,~2,\cdots,~m\).

If you expand the polynomial \(\displaystyle \left( {\sum\limits_{k = 1}^m {x^k } } \right)^n \) the term \(\displaystyle Jx^H\) tells us if we toss n m-sided dice then there are \(\displaystyle J\) ways to get the sum \(\displaystyle H\).

Look at

this webpage.

You see that models tossing five nine sided dice. The term \(\displaystyle 330x^{38}\) tells us that there are 330 ways that the sum of the five will equal 38.

So \(\displaystyle \mathcal{P}(S=38)=\frac{330}{9^5}\).

From there on it is a simple matter of using binomial distribution on N trials.