When it says that the cities are routed linearly, it means that these cities are located right next to each other. From the left, the order is Springfield, Clarksville, then Allentown. You have details on the number of gallons and the mileage. To get the distance travelled, just multiply the mileage with the gallons, to cancel out gallons leaving you with the distance in miles.
Now, since Molly travelled from Springfield to Allentown, the total distance she covered is the distance Edward travelled and the unknown distance between Springfield and Clarksville, denoted as x in the picture. So, the equation is then
Molly's distance = x + Edgar's distance
26 miles/gal(2 gal) = x + 17 miles/gal(1 gal)
x = 35 miles