X^3+8X^2+5X+a
(X^2+3X-10)(X+A)
=X^3+AX^2+3X^2+3AX-10X-10A
=X^3+(A+3)X^2+(3A-10)X-10A
A+3=8
3A-10=5
-10A=a
A=5,a=-50