Answer : $\;500\;J$

Explanation :

$dQ=du+dw \quad $ By sign convention

$dQ=+400\;J quad$ Heat absorbed is positive

$dw=-100\;J \quad$ heat given out is negative

$du=dQ-dw \quad$ Work done by the system is positive

$=400 - (-100)\quad$ Work done on the system is negative

$=500 \;J$