That is a good point. If you could wipe their memories in such a way that they didn't have any lasting psychological damage, that would make it significantly better. It's still pretty extreme; a month is a long time, and if we're talking about a serious attempt to maximize their pain during that time, there's a lot of pain that we'd have to cancel out. X and N will still need to be very large, but not as large as without the drugs.
Most of the usual thought experiments that justify expected utilitarialism trade off fun for fun, or suffering for suffering. Here's a situation which mixes the two. You are offered to press a button that will select a random person (not you) and torture them for a month. In return the machine will make N people who are not suffering right now have X fun each. The fun will be of the positive variety, not saving any creatures from pain.
1) How large would X and N have to be for you to accept the offer?
2) If you say X or N must be very large, does this prove that you measure torture and fun using in effect different scales, and therefore are a deontologist rather than a utilitarian?