What are the products formed when magnesium reacts with hydrochloric acid?