I'm looking for a more generic way to apply this, but here's the problem in a nutshell. I have a number of balls that are divided up into partitions. For instance, I might have the following:

* 5 blue balls
* 4 green balls
* 2 yellow balls
* 1 red ball
* 1 black ball

I'm trying to put them into a number of buckets, let's say 3 for this problem, although the number can vary. Each bucket must have a unique combination of balls when all is said and done, in other words, no two buckets can contain the same number of the same type of balls. All balls must be in a bucket to satisfy the conditions. An empty bucket is allowed. How many combinations are there?

Just to explain a bit more, if two buckets each had 2 blue balls and 1 green ball, that would not be acceptable. However, if one had 2 blue balls and 2 green balls, and the other had 2 blue balls and 1 green ball, that's okay. Also, one empty bucket is okay, as it is distinct.

For a very simple example, imagine 4 blue balls, 2 red balls, going into 4 buckets. There are 7 combinations, bbb|rr|b|0, bb|brr|b|0, b|bbrr|b|0, br|bbr|b|0, bbb|br|r|0, bbr|bb|r|0, and b|br|bb|r where 0 is empty, b is blue, r is red, and | is the divider between partitions.

Note that I want to understand how this works to apply it to a larger problem I'm working on, but if I can understand this, then it will make the larger problem easier.

I should add, I only need the exact number, I do not need to show every combination there is.