Counting the number of ways to get a sum of $2012$, given that any number of cards can be chosen 
A person has $32$ cards out of which $10$ cards, each of blue, green and red colours, have
denominations as $\{2^1, 2^2,\cdots , 2^{10}\}$ and one black and one white each of whose value is unity. What is the number of ways in which the person can get a sum of $2012$ if he can choose any number of cards?

I couldn't think much in it, except that number of ways of choosing $\text{(blue,black,white)}$ is equal to if he chooses $\text{(green,black,white) or (red,black,white)}$.
So if suppose he chooses $\text{(blue,black,white)}$, the total sum of the cards would be $$1+1+2+2^2+\cdots+2^{10}=2^{11}=2048$$
So, if we remove the cards whose sum equals $36$, we will get $2012$. Thus, we need to find the number of ways in which the sum on cards equals $36$. I tried it, but there were so many cases, that I gave up. I also haven't taken the case if he chooses for instance $\text{(blue,green,white)}$ etc.
The answer to this is $1007^2$, which suggests some easy method must be there.
Any hints would be appreciated!
 A: Recolour the cards of value  $1$ blue and green. Let $a, b,c$ be the sum of the numbers on the blue, green and red cards respectively. Making use of the unique representation of numbers using binary digits:-
The problem is equivalent to finding the number of ordered triples of non-negative integers $(a,b,c)$ such that $a+b+c=2012$, where $c$ must be even.
Considering all the possibilities for $c$, gives $$1+3+5+ ... +2013=1007^2.$$
A: In terms of generating functions the problem is equivalent to finding the coefficient at $x^{k}$, with $k=2012$ in the product:
$$
(1+x)^2\prod_{i=1}^{10}\left(1+x^{2^i}\right)^3=\frac1{1+x}\prod_{i=0}^{10}\left(1+x^{2^i}\right)^3=\frac1{1+x}\left(\sum_{i=0}^{2^{11}-1}x^i\right)^3.\tag1
$$
Thus the problem essentially boils down to determine the coefficients $c_k$ at $x^k$ in the expression:
$$\left(\sum_{i=0}^{m-1}x^i\right)^n.
$$
This problem is equivalent to asking about the number of ways to distribute $k$ balls among $n$ bins with the capacity of each bin being $m-1$. In our case we however do not need to bother about capacity because $k<m$. So we need to find:
$$
[x^k:]\sum_{i\ge0}\binom{i+n-1}{n-1}x^i\sum_{j\ge0}(-x)^j=
\sum_{j\ge0}(-1)^j\binom{k+n-1-j}{n-1}.
$$
It remains only to prove that
$$
\sum_{j=0}^k(-1)^j\binom{k+2-j}{2}=\left(\frac k2+1\right)^2
$$
for even $k$ which I left as an exercise.
A: Let's consider only the blue, green and white cards chosen. If the total sum of all numbers on these cards is $2012$ or less, than there is only a single way to choose remaining red and black cards containing numbers $\{2^0, 2^1, \dots, 2^{10} \}$ such that the total sum of all cards is $2012$. (Prove that)
Therefore, the number of ways (let's denote it by $N_1 (1006)$) in which the person can get a sum of $2012$ if he can choose any number of cards equals the number of ways in which the person can choose any number of blue, green and white cards such that the sum of numbers on cards is $2012$ or less.
By $N_2 (k) $ let's denote the number of ways to get a sum of $2k$ or less on green and blue cards, where $k \leq 1023 $.
By ${\rm Sum_{green}} (\leq j) = j+1$ let's denote the number of ways to get a sum of $2j$ or less on green cards only, $j \leq 1023$, by $ {\rm Sum_{blue}} ( m) = 1$ let's denote the number of ways to get a sum of exactly $2m$ on blue cards only, $m \leq 1023$.
Note that $\displaystyle N_2(k) = \sum\limits_{i=0}^k \left( {\rm Sum_{blue}} (i) \cdot {\rm Sum_{green}} (\leq k - i) \right) = \sum\limits_{i=0}^k (k - i + 1) = \frac{ (k+1)(k+2)}{2} $ .
The $N_1(1006)$ is the sum of the number of ways to chose green, blue and white cards such that a white card is present ($=N_2(1005)$) and the number of ways to chose green, blue and white cards such that a white card is absent ($=N_2(1006)$). Therefore
$\displaystyle N_1(1006) = N_2(1005) + N_2(1006) = \frac{1006 \cdot 1007}{2} + \frac{1007 \cdot 1008}{2} = 1007^2 $
