The heat lost consists of 4 parts:
1. Heat released as the steam cools from 400°C to 100°C: Q1=m csteamΔT
2. Latent heat of vaporization, as the steam condenses at 100°C: Q2=m Lv
3. Heat released as the water cools from 100°C to 0°C: Q3=m cwaterΔT
4. Latent heat of fusion, as the water freezes at 0°C: Q4=m LF
Look up the constants, csteam, cwater, Lv, and Lf, calculate Q1 through Q4, then add them! Enjoy! :)