First law of thermodynamics is a consequence of conservation of