We have a factor of $\frac{n(n-1)}{2}$ outside.

That is $$S_n = An +\frac{an(n-1)}{2}+\frac{dn(n-1)(n-2)}{6}$$

$n(n-1)(n-2)$ being the product of $3$ consecutive integers is divisible by $6$.