The First Law of Thermodynamics.
The change in the internal energy of a system is equal to the heat that flows into the system minus the work done by the system.