how to determin number of combinations

hello...

I'm having a bit of problem with one simple task :D First sorry if I put this thread in wrong place :D

I know how to calculate number of combinations (without repetition)

and that's ok :D

but now I have big problem :) I have to calculate number of combinations with repetitions :D so i tried like this :D

when i have 2 variables A and B with second expansion i have :

so it's four combinations :D

for third expansion i have :

so there is 8 combinations .... and at first i think formula should be or in my case now meaning but as I get to problem with 4 variables and need to do third expansion by that formula I need 64 combinations... I wrote all of them and I got 40... now I'm confused very much because in next task I have problem with 10 variables and third expansion ... and there is no way that i can wrote them all to find pattern ....

can anyone please help me with this :D I also find some formulas for similar things but none of them can be any use to me in this problem :D