Answer
$600$ dollars worth of merchandise and we would spend $580$ dollars in total.
Work Step by Step
Let $x$ be the original amount we should have spent on merchandise. Then our equation is: $100+0.8x=40+0.9x\\60=0.1x\\x=600$
So we would have to buy $600$ dollars worth of merchandise and we would spend $580$ dollars in total.