How many combination exist in this situation? There are $h$ groups of different elements each has a different size:
$$
\begin{matrix}
\text{Group 1}: ~~~~a_{11}& a_{12} & ... & a_{1k_1} & \\
\text{Group 2}:~~~~a_{21}& a_{22} &  ...& a_{2k_2} \\
\vdots&&&\\
\text{Group h}:~~~~a_{h1}& a_{h2} & ... & a_{hk_h} & \\
\end{matrix} 
$$
From each group, we can choose at most one element. I like to know how many combinations we can create when the order is not important.
If the length is 1, the answer is $\sum_{i=1}^{h}k_i$. If the length is 2, I think the answer is $$(\sum_{i=1}^{h}k_i)^{2} - \sum_{i=1}^{h}k_i^2$$
but I can not do the math when the length of the combination is larger. Can any body help me?
Thanks

If $l$ is the length, then the number of combinations is:
$$
 \sum_{1\leq i_1<i_2<...<i_l\leq h} k_{i_1}k_{i_2}\dots k_{i_l}
$$
See also Willie Wong's comment for an alternate way of writing that sum.
