Statistical problem: how many books of different widths fit it into a self of a limited certain width? Let's say I have N sets of books, being the size of the books in a set the same. The cardinality of the every set is different: I might have 3 books of width 5 units (first set), 6 books of width 10 (second set), ...., 2 books of width 20 (Nth set), and the width of the shelf W is equal to 100.
What is the probability density function of the number of books fitting into the shelf with width W, if I pick books sequentially and randomly? Once a book is picked and stored in the shelf, there is replacement: a book of the same width is available again to be picked and stored into the shelf in the next trial (so basically the different values of cardinalities of the sets determine the probability of picking a book with a certain size).
What have I tried?


*

*I might describe the storing of one book picked randomly with its moment generating function. For the particular case described:
     $f(z)= 3\cdot z^5+6\cdot z^{10}+...+2 \cdot z^{20}$

*With only one book, the number of ways of keeping ONLY one book (at not more) into the shelf with W=100 is equal to zero ($0 \cdot z^{100}$). 

*If I pick k books randomly, the number of ways to store ONLY these k books (and not more) into the shelf with width W=100 is equal to the coefficient of the term $z^{100}$ in $(f(z))^k$.  

*For example, with 5 books, there is only one combination summing up 100 (5 books of width 20, the coefficient of $z^{100}$ in $(f(z))^5$.  

*From this, somehow generate a discrete probability density function with the possible different combinations (probability of having only 5 books as the number of combinations with 5 books(=1)/number of total combinations, probability of having 6 books as the number of combinations with 6 book/number of total combinations,....). The total number of combinations is equal to $number \ combinations \ with \ 5 \ books(=1)+number \ of combinations \ with \ 6 \ books+....+number \ of \ combinations \ with \  100/5(minimum \ width)(=1)$. 


So, am I on right path? 
Thanks
Editing: there was a small error in the given example. Sorry.
2#edition: I think there is an error in the expression for $f(z)$. In the case we had books of 5, 10, 15 and 20, the generating function $f(z)$ would be given by $f(z)=1 \cdot z^5+2 \cdot z^{10} + 4 \cdot z^{15}+8 z^{20}$.
 A: Note: I've made corrections to the calculation here.
Are you on the right path? Pretty close. 
To make sure I've interpreted the statement of the problem as you really intend, I assume that there are $n$ types of books, that books of type $i$ have some probability $p_i$ of being selected, and that books of type $i$ have some width $w_i$. (In your example, $p_1$ would be $3$ over the total number of books, and $w_1$ would be 5, etc.) Your question is about  the probability that $k$ selected books have a total width of $w$; let's call this probability $p_{k,w}$. The  ordinary generating function for the widths of a single book selection is $\sum_i p_ix^{w_i}$. Repeated selections correspond to multiplication of generating functions. So, as you noted, $p_{k,w}=[x^w](\sum_ip_ix^{w_i})^k$, or equivalently $$g_k(x)\stackrel{\rm def}=\sum_{w\ge0} p_{k,w}x^w=\bigl(\sum_{i=1}^np_ix^{w_i}\bigr)^k.$$
Some people would consider the generating function $g_k$ equivalent to a probability density function. However, if you would like a single generating function for both the number of selected books and their widths, you should consider a generating function, such as $h(x,y)=\sum_{k,w}p_{k,w}x^wy^k$. By grouping, $h(x,y)=\sum_k(\sum_ip_ix^{w_i})^ky^k$, which is a geometric series, and so the desired two-variable generating function is
$$\sum_{k,w}p_{k,w}x^wy^k=\frac1{1-y\sum_{i}p_ix^{w_i}}.$$
