What's with x, a, y, z, c???
Variables should have proper names that indicate what they are!
I'm not sure what you are trying out, but if you are trying to remove a quantity and it can either be one item or the other you are better of making a kind of exchange rate or something.