#codefestival2015okinawaf. [code_festival_2015_okinawa_f]Falconry
[code_festival_2015_okinawa_f]Falconry
Problem
Falconry is a kind of hunting using a bird of prey. One day, three falconers (the person who do falconry) decided to carry out the next competition.
There are checkpoints on a two-dimensional plane, the checkpoint exists on the point of which the coordinate is . The three falconers exist on the points of which the coordinates are , , . Each one of them has one bird. In the beginning, every bird stays with its owner, thus the coordinate of it is the same as that of its owner.
When the competition begins, birds will start to move. The purpose of this competition is to let all the checkpoints to be passed through by one bird at least, and to minimize the sum of the moving distance of the three birds. In this case, distance refers to the Euclidean Distance. The distance between two points and is .
Checkpoints can be passed through in any order. For a bird, it is allowed to pass no checkpoint or pass all the checkpoints. Also, the same checkpoint can be passed through more than once. In addition, suppose that each bird can choose the optimal way to move.
The coordinates of all the checkpoints and the three falconers will be given. Please find the minimum value of the sum of the moving distance of three birds.
Input
Inputs will be given by standard input in following format
:
- For the first line, will be given.
- From the second line, there are additional lines, for each line the coordinate of a checkpoint will be given. For the line, integer , will be given divided by a space.
- For the line, 、 will be given divided by a space.
- For the line, 、 will be given divided by a space.
- For the line 、 will be given divided by a space.
In addition, all the coordinates are different from each other.
In other words, if then .
Also, for each , , and will hold. Furthermore, , and will hold.
Output
Output the minimum value of the sum of the moving distance of three birds when all the checkpoints have been passed through by at least one bird in one line.
The output is acceptable if absolute error or relative error is or less.
Print a newline at the end of output.
Input Example 1
3
1 1
102 98
197 -197
0 0
100 100
200 -200
Output Example 1
8.485281374239
- If the bird that starts from passes through the first checkpoint, the moving distance will be .
- If the bird that starts from passes through the second checkpoint, the moving distance will be .
- If the bird that starts from passes through the third checkpoint, the moving distance will be .
Hence, by moving all the checkpoints will be passed through at least once.
Input Example 2
3
1 3
2 1
0 -2
0 0
-500 0
0 1000
Output Example 2
7.841619252964
If the bird that starts from passes the third checkpoint, then passes the second checkpoint, then passes the first checkpoint, the moving distance in total will be .
Input Example 3
6
3 7
1 10
-2 -5
-3 4
0 2
6 6
-3 9
0 4
1 1
Output Example 3
22.585258012904