<s>[INST] coefficient of $x^{17}$ in the expansion of $(1+x^5+x^7)^{20}$ I found this questions from past year maths competition in my country, I've tried any possible way to find it, but it is just way too hard.

find the coefficient of $x^{17}$ in the expansion of $(1+x^5+x^7)^{20}$
(A)3400 (B)3410 (C)3420 (D)3430 (E)3440

so it would be $$x^{140} + ...... + 1$$
This requires binomial theorem and Multinomial theorem, but I'm not sure how to calculate it. Any tips or formula would be appreciate.
 [/INST] $(1+x^5+x^7)^{20}=\{(1+x^5)+x^7\}^{20}$
$=(1+x^5)^{20}+\binom{20}1(1+x^5)^{20-1}(x^7)^1+\binom{20}2(1+x^5)^{20-2}(x^7)^2+\cdots+(x^7)^{20}$
So the required sum will be 
the coefficient of $x^{17}$ in $(1+x^5)^{20}$
$+\binom{20}1\cdot$ the coefficient of $x^{17-7}$ in $(1+x^5)^{20-1}$
$+\binom{20}2\cdot$ the coefficient of $x^{17-7\cdot2}$ in $(1+x^5)^{20-2}$
Clearly the exponent of $x$ in $(1+x^5)^n$ will be divisible by $5$
So, the first &  the last summand must be zero
Now for the coefficient of $x^{17-7\cdot1}$ in $(1+x^5)^{20-1},$
the $r+1$th term $\binom{19}r(x^5)^r=\binom{19}rx^{5r}$ and we need $5r=10\iff r=?$
</s>