Applied at a crude level, this tells you that removing punishment misery will cause addiction misery to rise (which is an important refinement - a “total misery accounting” perspective that doesn’t have this included will believe that removing punishment misery would leave addiction misery unchanged, thus improving total misery).
Applied at a more sophisticated level, this gets you analyzing incremental changes in punishment or addiction policy: e.g. this new law adds x punishment misery, how much does it reduce addiction misery by? If the answer is “less than x”, you now have some objective basis for concluding this policy is “needlessly cruel”.
You can't do this. It is neither ethical or practical. There's plenty we could do as a society that may hypothetically "reduce misery", but we don't insofar as it violates their rights.
It's not even possible to do. This is highly subjective. For instance, how do you rate the genocide that's baked into prohibition? Does that just not count because you don't respect a part of our subculture? What about people that are now in pain and misery, but we're maybe hurting their health with illegal drugs (although some of them seemed to be doing fine and not increasing their dosages).
Does the fact that they were previously dependent on drugs, somehow negate their pain, or inability to function well. Is being addicted to drugs some kind of weird nightmare scenario, like the matrix, where the subject is always worse off?
Punishment does deter things. Whether it is the only thing that can is a different matter. But I think a lot of those who want alternatives need to get out of the "punishment does not deter" narrative, which is about as silly as saying that oil and gas don't provide energy because they are bad for the environment.