Hey can anyone please explain the editorial of problem E in codeforces round 636 div 3 in detail?

problem : https://codeforces.com/contest/1343/problem/E

Trying drawing it out on a graph. You will observe that you need 2 paths to achieve the task, which will always diverge at a point say B -> X to X -> A and X -> C . Calculate a X such that cost is minimized.

hey thanks!