The First law of Thermodynamics can be written, for most uses in Mechanical Engineering using the following formula:

dQ+M*dh=W

Where dQ is the amount of heat transferred from the system,
M is the Mass of the system, dh is the change in the Enthalpy of the system
and W is the amount of Work done on the system.