Answer
See the figure below.
Work Step by Step
The system loses 400 J of its potential energy due to doing 400 J of work on the environment. Now we know where the potential energy goes but what about the increase of the thermal energy where did it come from?
It must come from the initial kinetic energy.
So, the process is as seen below.