The first law of thermodynamics states that the change in internal energy of a system is equal to the heat added to the system minus the work done by the system:
ΔU = Q - W
where ΔU is the change in internal energy, Q is the heat added to the system, and W is the work done by the system.
In this case, the gas absorbs 252 J of heat from the surroundings, which means that Q = +252 J (note the positive sign, indicating that heat is being added to the system). The gas does 86.0 J of work on the surroundings, which means that W = -86.0 J (note the negative sign, indicating that work is being done by the system on the surroundings).
Substituting these values into the first law equation, we get:
ΔU = Q - W = +252 J - (-86.0 J) = +338 J
Therefore, the change in internal energy of the gas is +338 J. Note that the positive sign indicates that the internal energy of the gas has increased, since heat was added to the system and work was done by the system on the surroundings.