x2+13x+40=(x+5)(x+8);
x2+2x-35=(x-5)(x+7);
x2-4x-5=(x-5)(x+1);
x2+6x-16=(x+8)(x-2).
Product becomes:
{(x+5)(x+8)/[(x-5)(x+7)]}{(x-5)(x+1)/[(x+8)(x-2)]}=
(x+5)(x+1)/[(x+7)(x-2)]=(x2+6x+5)/(x2+5x-14).
This can be further reduced:
(x2+5x-14+x+19)/(x2+5x-14)=1+[(x+19)/(x2+5x-14)].