USACO Silver February 2018 Teleportation Understanding Solution

I read the editorial for the third problem of the USACO Silver February 2018 Contest, Teleportation (, but it seems a little difficult to understand.
In the editorial (, I don’t quite get how the problem relates to slopes/breakpoints.
Also, I’m not really sure what does y = 2a, y = b, y = 2b - 2a… in the editorial meant, as well as how those values can be derived and used when writing the program.
Can someone please help?

Let’s say that you only have to transport a single pile of manure from point A to B. The editorial describes the distance that you would need to travel (corresponding to the y-value) given the teleporter location and the “type” of travel that you have to do.