this is not calculus ... thread moved to Discrete Math
"let n_i denote the number of appearances of letter a_i in a word"? Which word? Are you saying that there's a single unknown-yet-fixed word in the alphabet A which defined the numbers
OR, are you treating as k distinct functions functions from the domain of all possible finite words in A into the non-negative integers?
I would guess the later, but I'm not sure.
With that assumption:
For the middle example: imagine there are 10 slots, numbered 1 through 10, that you need to fill with those letters to make your word. Choose 5 slots to fill with the A's, and then, from the 5 remaining slots, choose 2 to fill with the B's (Obviously the rest are then filled in with C's.) The number of ways to do that will be the number of distinguishable length 10 words using 5 A's, 2 B's and 3 C's.