Morality turns on whether the pleasure precedes the pain or follows it (provided it is sufficient). Thus, it is immoral to get drunk because the headache comes after the drinking, but if the headache came first, and the drunkenness afterwards, it would be moral to get drunk.
— Samuel Butler, Notebooks, 1912