Intuition behind this Olympiad problem using generating functions From here https://web.archive.org/web/20160418085410/https://db.math.ust.hk/notes_download/elementary/algebra/ae_A11.pdf

Example 4.1. (CGMO 2004)
A set of poker has $32$ cards. $30$ of them are
in red, yellow and blue, with $10$ cards in each colour, given the
numbers $1, 2, …, 10$ respectively. $2$ of them are different jokers, both
with the number $0$. A card with the number $k$ counts for $2^k$ points. Call
a group of cards a ‘good group’ if the sum of their points is $2004$.
Calculate the number of ‘good groups’

They define:
$$G(x) = (1+x)^2(1+x^2)^3(1+x^4)^3...(1+x^{1024})^3$$
I cannot figure out how this was constructed exactly. What is the logic behind building this in this way?
 A: For each card numbered $k$, you can either put it in your group, which adds $2^k$ to your score, or leave it out of the group, which keeps your score the same. If we want the coefficient of $x^s$ to represent the number of ways to score exactly $s$, this means that we multiply by $(1 + x^{2^k})$. Why? Because that means either multiply by $1 = x^0$ OR multiply by $x^{2^k}$, which means either adding $0$ to the score OR adding $2^k$ to the score.
Then, it is just a matter of counting the number of cards of number $k$ and multiplying the relevant factor. We have two jokers numbered $0$, which gives two factors of $(1+x)$, and three of all other cards numbered $1$ to $10$ which gives three factors of each of $(1+x^2), (1+x^4), \ldots, (1 + x^{2^{10}})$.
The end result is the expression
$$G(x) = (1+x)^2(1+x^2)^3(1+x^4)^3...(1+x^{1024})^3$$
By construction, the coefficient of $x^s$ in this expression is the number of ways to get score $s$. So we want the coefficient of $x^{2014}$ in the above.
