The work done when a gas is compressed in a cylinder like that shown in Figure

6.5 is 351 J. During this process, there is a heat transfer of 269 J from the gas to
the surroundings. Calculate the energy change for this process.

Not sure how to do this please explain with correct answers.