
The first line of input contains an integer 'N', the number of fishing spots.
The second line contains three space-separated integers, representing the positions of the three gates.
The third line contains three space-separated integers, representing the number of fishermen waiting at each corresponding gate.
Print a single integer representing the minimum possible total distance.
Since there are only 3 gates, there are only 3! = 6 possible orders to open them. The solution is to simulate the process for all 6 permutations and find the minimum total cost.
For each gate, the fishermen will greedily occupy the closest available spots.
Save Ninja Land
Save Ninja Land
Save Ninja Land
Save Ninja Land
Save Ninja Land
Save Ninja Land
Construct The Parameter
Construct The Parameter
Construct The Parameter
Construct The Parameter
Construct The Parameter
Construct The Parameter
Construct The Parameter
Construct The Parameter
Construct The Parameter
Construct The Parameter
Construct The Parameter
Construct The Parameter
Construct The Parameter
Points Visible
Points Visible
Points Visible
Circle Intersection
Circle Intersection
Circle Intersection
Circle Intersection
City Lights