The U.S. stock market careened through a manic Monday, going from a steep early loss to a solid gain as worries turned into hope that the war with Iran may not last that long.