Heat, dq=400calorie=+400J
Work done by the system, dw=1000J
Change in internal energy,
du=dq−dw
=400−1000
=−600J