P43: Pleasure can be excessive and evil, whereas Pain can be good insofar as the Pleasure, or Joy, is evil.
Dem.: Pleasure is a Joy which, insofar as it is related to the Body, consists in this, that one (or several) of its parts are affected more than the others (see its Def. in IIIP11 S). The power of this affect can be so great that it surpasses the other actions of the Body (by P6), remains stubbornly fixed in the Body, and so prevents the Body from being capable of being affected in a great many other ways. Hence (by P38), it can be evil.
Pain, on the other hand, which is a Sadness, cannot be good, considered in itself alone (by P41). But because its force and growth are defined by the power of an external cause compared with our power (by P5), we can conceive infinite degrees and modes of the powers of this affect (by P3). And so we can conceive it to be such that it can restrain Pleasure, so that it is not excessive, and thereby prevent the body from being rendered less capable (by the first part of this Proposition). To that extent, therefore, it will be good, q.e.d.