Theory of the Heats of Formation of Transition-Metal Alloys