A gas contained in a cylinder fitted with a frictionless piston expands against a constant external pressure of 1 atm from a volume of 5 litres to a volume of 10 litres. In doing so it absorbs 400 J of thermal energy from its surroundings. Determine the change in internal energy of system.