The train goes 2.1 km first
then goes with constant speed of 24m/s for 400s
so distance=V x t= 24 x 400 = 9600m that means 9.6km
then it slows down from 24m/s to 0
so it takes
Vf- V0=at
0-24=-0.065 xt => t=369.23 s
that means it will go the distance of
distance= V0t+1/2 gt2=24 x 369.23-1/2( 0.065 x 369.23)=8849.52m that means 8.8km
so in total 2.1+9.6+8.8=20.5km
Please let me know if you have any question