2022 SSMO Relay Round 4 Problems/Problem 2

Problem

The roots of $f(x)=x^3+5x+8$ are $r_1,r_2,r_3.$ Let $g_n(x)$ be a polynomial with roots $r_1+n, r_2+n,r_3+n.$ If\[S=\sum_{n=1}^{T}(-1)^{n}g_n(5),\]find the remainder when $S$ is divided by 1000.

Solution