You have g groups and o object. Determine a formula to calculate all possibilities. For example, if we set g = 3 and o = 3 we should get 10.
3 0 0
0 3 0
0 0 3
2 1 0
2 0 1
1 2 0
1 0 2
1 1 1
0 1 2
0 2 1
I came to this answer by brute force counting all the possibilities, but do not understand how to generate a general formula if there even is one. A group of 0 doesn't make sense, but I am including them to see how they would be accounted for.