Its a simple reflection problem.... since the shortest distance between two points is a line, just reflect one of the cities through the railroad line and connect the two cities by a line. The point where the line intersects the railroad line is where you put it...
