Energy of formation for dilute alloys with transitional impurities