Let t be the time taken by train and s be the speed of the train.
The distance of the train is st.
If the train is 10 km per hour faster, then,
sts+10=t−2
10t−2s=20 (1)
If the train is 10 km per hour slower, then,
sts−10=t+3
3s−10t=30 (2)
From equation (1) and (2),
s=50,t=12
So the distance of the train is 50×12=600km.