Counting polynomials with complex roots 
Let $G$ be the set of polynomials of the form $P(z)=z^n+c_{n-1}z^{n-1}+\cdots+c_2z^2+c_1z+50$,
where $c_1,c_2,\cdots, c_{n-1}$ are integers and $P(z)$ has $n$ distinct roots of the form $a+ib$ with $a$ and $b$ integers. How many polynomials are in $G$?

My observations so far are that we'll have this product $(a_1^2+b_1^2)(a_2^2+b_2^2)\cdots (a_n^2+a_{n-1}^2)=50$. I have tried counting directly since $50$ has few factors, but I'm not sure that I have all of the possible arrangements, and it has lead to the incorrect answer.
The actual answer is

 528.

I would appreciate hints on how to go on.
 A: My approach to this question is similar to yours:
$$(a_1^2+b_1^2)(a_2^2+b_2^2)\cdots (a_n^2+a_{n-1}^2)= \pm50$$
We can observe that the possible integer $a_n$, $b_n$ and $n$ are:
When $n=1$,
$$P(z)=z+50$$
Therefore, $$z=-50$$ and $$a_n=-50, b_n=0$$
When $n=2$,
$$P(z)=z^2+c_1z+50$$
$$50=50$$
$$50=(\pm7)^2+(\pm1)^2=(\pm5)^2+(\pm5)^2$$
In this case, there are $2\times2+1\times2=6$ combinations:
$$z_1=1+7i, z_2=1-7i, c_1=-2$$
$$z_1=-1+7i, z_2=-1-7i, c_1=2$$
$$z_1=7+i, z_2=7-i, c_1=-14$$
$$z_1=-7+i, z_2=-7-i, c_1=14$$
$$z_1=5+5i, z_2=5-5i, c_1=-10$$
$$z_1=-5+5i, z_2=-5-5i, c_1=10$$
When $n=3$,
$$P(z)=z^3+c_2z^2+c_1z+50$$
$$50=1\times50=2\times25=5\times10$$
In this case, we need to express 50 as $(a^2+b^2)\times c$
$50=(\pm7)^2+(\pm1)^2=(\pm5)^2+(\pm5)^2$ and $1=(\pm1)^2$
$25=(\pm5)^2=(\pm4)^2+(\pm3)^2$ and $2=(\pm1)^2+(\pm1)^2$
$10=(\pm3)^2+(\pm1)^2$ and $5=(\pm2)^2+(\pm1)^2$
Therefore, this will give us $2\times2+1\times2+1\times2=8$ combinations.
Continue this process until $n=6$ (as $50=2\times5\times5$),
you should be able to get all the answers.
