You’re right about the cost per averted headache, but we aren’t trying to minimize the cost per averted headache; otherwise we wouldn’t use any drug. We’re trying to maximize utility. Unless avoiding several hours of a migraine is worth less to you than $5 (which a basic calculation using minimum wage would indicate that it is not, even excluding the unpleasantness of migraines—and as someone who gets migraines occasionally, I’d gladly pay a great deal more than $5 to avoid them), you should get Drug A.
You’re right about the cost per averted headache, but we aren’t trying to minimize the cost per averted headache; otherwise we wouldn’t use any drug. We’re trying to maximize utility. Unless avoiding several hours of a migraine is worth less to you than $5 (which a basic calculation using minimum wage would indicate that it is not, even excluding the unpleasantness of migraines—and as someone who gets migraines occasionally, I’d gladly pay a great deal more than $5 to avoid them), you should get Drug A.