I did some math to figure out the optimal number of atoms to put in a chain before starting to pass it left/right for max distance, and it came out to one atom to the left, and two to the right (I start passing left first), which is definitely optimal for my strategy, but there's very likely a strategy I haven't thought of yet. I really hate not making a solution looping, but oh well, it saves something like 20 g.