Bouldering
Bouldering is a style of rock climbing. Boulderers are to climb up the rock with bare hands without supporting ropes. Your friend supposed that it should be interesting and exciting, so he decided to come to bouldering gymnasium to practice bouldering. Since your friend has not tried bouldering yet, he chose beginner’s course. However, in the beginner’s course, he found that some of two stones have too distant space between them, which might result his accidentally failure of grabbing certain stone and falling off to the ground and die! He gradually becomes anxious and wonders whether the course is actually for the beginners. So, he asked you to write the program which simulates the way he climbs up and checks whether he can climb up to the goal successfully.
For the sake of convenience, we assume that a boulderer consists of 5 line segments, representing his body, his right arm, his left arm, his right leg, and his left leg.
One of his end of the body is connected to his arms on their end points. And the other end of the body is connected to his legs on their end points, too. The maximum length of his body, his arms, and his legs are A, B and C respectively. He climbs up the wall by changing the length of his body parts from 0 to their maximum length, and by twisting them in any angle (in other word, 360 degrees). Refer the following figure representing the possible body arrangements.
Figure 1: An example of possible body arrangements.
5 line segments representing his body, arms and legs. The length of his body, arms and legs are 8, 3 and 4 respectively. The picture describes his head as a filled circle for better understanding, which has no meaning in this problem.
A boulderer climbs up the wall by grabbing at least three different rocks on the wall with his hands and feet. In the initial state, he holds 4 rocks with his hands and feet. Then he changes one of the holding rocks by moving his arms and/or legs. This is counted as one movement. His goal is to grab a rock named "destination rock" with one of his body parts. The rocks are considered as points with negligible size. You are to write a program which calculates the minimum number of movements required to grab the destination rock.
Input
The input data looks like the following lines:
n A B C x_1 y_1 x_2 y_2 x_3 y_3 ... x_n y_n
The first line contains n (5 ≤ n ≤ 30), which represents the number of rocks.
The second line contains three integers A, B, C (1 ≤ A, B, C ≤ 50), which represent the length of body, arms, and legs of the climber respectively.
The last n lines describes the location of the rocks. The i-th contains two integers x_i and y_i (0 ≤ x_i, y_i ≤ 100), representing the x and y-coordinates of the i-th rock.
In the initial state, the boulderer is grabbing the 1st rock with his right hand, 2nd with his left hand, 3rd with his right foot, and 4th with left foot.
You may assume that the first 4 rocks are close to each other so that he can grab them all in the way described above.
The last rock is the destination rock.
Output
Your program should output the minimum number of movements to reach the destination stone.
If it is impossible to grab the destination stone, output -1.
You may assume that, if A, B, C would be changed within 0.001, the answer would not change.
Following figures represent just an example of how the boulderer climbs up to the destination in minimum number of movements. Note that the minimum number of movements can be obtained, by taking different way of climbing up, shortening the parts, rotating parts etc.
Figure 2: An example of minimum movement for sample input 1.
Figure 3: An example of minimum movement for sample input 2.