velocity = distance /time; distance = velocity*time
since they will meet at exact distance from the station the distance for 2 trains are same
lets say first train takes x hours;
50*x = 175(x- 5)
50x= 175x -875
-125x = -875
x = 7
distance = 7*50 = 350 miles