To determine the change in energy of a system:
nDE  = q + w
n where E is the amount of energy
n q represents heat
n w represents work