To solve this problem we simply need to apply the concepts of energy conservation.
Let us break down the problem by the steps suggested by the statement:
For the first step we have to
[tex]Q=70J[/tex]
[tex]W=31J[/tex]
Where Q is heat absorbed and W the work done
[tex]U = Q+W[/tex]
[tex]U = 70 + 31 = 101 J[/tex]
For the second step we have to
[tex]Q = 31 J[/tex]
[tex]W =-70 J[/tex]
[tex]U = 70-31 = -39 J[/tex]
[tex]\Delta U_T = U_1+U_2[/tex]
[tex]\Delta U_T = 101 - 39 = 62 J[/tex]
Therefore the change in internal energy for entire process is 62J