Solution
We see that the expression for the polynomial P is very difficult to work with directly, but there is one obvious transformation to make: sum the geometric series:
P(x)=(x−1x18−1)2−x17=x2−2x+1x36−2x18+1−x17=(x−1)2x36−x19−x17+1=(x−1)2(x19−1)(x17−1)
This expression has roots at every 17th root and 19th roots of unity, other than 1. Since 17 and 19 are relatively prime, this means there are no duplicate roots. Thus, a1,a2,a3,a4 and a5 are the five smallest fractions of the form 19m or 17n for m,n>0.
173 and 194 can both be seen to be larger than any of 191,192,193,171,172, so these latter five are the numbers we want to add.
191+192+193+171+172=196+173=17⋅196⋅17+3⋅19=323159 and so the answer is 159+323=482.