One man's pain is another man's pleasure. The severity of the pain would be on some kind of bell curve, with no pain being zero, and for instance severity of pain increases negatively and pleasure increases positively. The bell curve would be skewed well into the negative, but there'd be a few on the positive who got some kind of pleasure out of the pain. You'd have to add in a probability equation (just to make things more fun).
Also, maximize morality is not always inversely proportional to distress. Some medical procedures cause distress, but are not immoral. You'd have to account for those things that cause distress but have little or no bearing on morality, unless you limit your sets to only those things where distress has an impact on morality, and even that will vary to some degree.