USACO Silver February 2018 Teleportation Understanding Solution

Hi!
I read the editorial for the third problem of the USACO Silver February 2018 Contest, Teleportation (http://www.usaco.org/index.php?page=viewproblem2&cpid=812), but it seems a little difficult to understand.
In the editorial (http://www.usaco.org/current/data/sol_teleport_silver_feb18.html), 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.