A piston in a heat engine does 500 joules of work, and 1,400 joules of heat are added to the system. Determine the change in internal energy and explain how this example demonstrates the conservation of energy.