I guess you could calc the combined and then subsequently remove the value of B1 ?

=SUMPRODUCT(--(SUM(A1:B1)>{0,20,40}),SUM(A1:B1)-{0,20,40},{12,-2,-2.5})-SUMPRODUCT(--(B1>{0,20,40}),B1-{0,20,40},{12,-2,-2.5})