Find the number of ways to choose 2005 red, green, and yellow balls such that the number of red balls is even or the number of green balls is odd.
We call $a_{n}$ the number of ways to choose $n$ balls in this manner and $A(X)$ the associated generating function. We then have:

$$
\begin{aligned}
& A(X)=\underbrace{\left(1+X^{2}+X^{4}+\ldots\right.}_{\text {red even }} \underbrace{\left(1+X+X^{2}+\ldots\right)}_{\text {green }} \underbrace{\left(1+X+X^{2}+\ldots\right)}_{\text {yellow }} \\
&+\underbrace{\left(1+X+X^{2}+\ldots\right)}_{\text {red }} \underbrace{\left(X+X^{3}+X^{5}+\ldots\right)}_{\text {green odd }} \underbrace{\left(1+X+X^{2}+\ldots\right)}_{\text {yellow }} \\
&+\underbrace{\left(1+X^{2}+X^{4}+\ldots\right)}_{\text {red even }} \underbrace{\left(X+X^{3}+X^{5}+\ldots\right)}_{\text {green odd }} \underbrace{\left(1+X+X^{2}+\ldots\right)}_{\text {yellow }} \\
&=\frac{1}{1-X^{2}} \frac{1}{1-X} \frac{1}{1-X}+\frac{1}{1-X} \frac{X}{1-X^{2}} \frac{1}{1-X}-\frac{1}{1-X^{2}} \frac{X}{1-X^{2}} \frac{1}{1-X}+ \\
&=(1+X) \frac{1}{\left(1-X^{2}\right)(1-X)^{2}}-\frac{1}{\left(1-X^{2}\right)^{2}} \frac{1}{1-X} \\
&= \frac{1}{(1-X)^{3}}-\frac{X^{2}+X}{\left(1-X^{2}\right)^{3}}=\frac{1}{(1-X)^{3}}-\frac{X^{2}}{\left(1-X^{2}\right)^{3}}-\frac{X}{\left(1-X^{2}\right)^{3}}
\end{aligned}
$$

We are looking for the coefficient of $X^{2005}$ in this generating function.

For $\frac{1}{(1-X)^{3}}$, it is $(-1)^{2005}\binom{-3}{2005}=(-1)^{1002} \frac{(-3)(-4) \ldots(-2007)}{2005!}=\binom{2007}{2}$

For $\frac{X^{2}}{\left(1-X^{2}\right)^{3}}$, it is 0 (since this series is $\frac{1}{(1-X)^{3}} \circ X^{2}$, so all coefficients with odd indices are zero).

For $\frac{X}{\left(1-X^{2}\right)^{3}}$, it amounts to calculating the coefficient of $X^{2004}$ in $\frac{1}{\left(1-X^{2}\right)^{3}}$ and thus the coefficient of $X^{1002}$ in $\frac{1}{(1-X)^{3}}$, which is $(-1)^{1002}\binom{-3}{1002}=(-1)^{1002} \frac{(-3)(-4) \ldots \ldots(-1004)}{1002!}=\binom{1004}{2}$

The answer is therefore $\binom{2007}{2}-\binom{1004}{2}$.