BP on sum-prod semiring