finalized sum-out and factor-product