In this problem, you will compute how much food you need to purchase for a trip across the desert on
foot.
At your starting location, you can purchase food at the general store and you can collect an unlimited amount of free water. The desert may contain oases at various locations. At each oasis, you can collect as much water as you like and you can store food for later use, but you cannot purchase any additional food. You can also store food for later use at the starting location. You will be given the coordinates of the starting location, all the oases, and your destination in a two-dimensional coordinate system where the unit distance is one mile.
For each mile that you walk, you must consume one unit of food and one unit of water. Assume that these supplies are consumed continuously, so if you walk for a partial mile you will consume partial units of food and water. You are not able to walk at all unless you have supplies of both food and water. You must consume the supplies while you are walking, not while you are resting at an oasis. Offcourse, there is a limit to the total amount of food and water that you can carry. This limit is expressed as a carrying capacity in total units. At no time can the sum of the food units and the water units that you are carrying exceed this capacity.
You must decide how much food you need to purchase at the starting location in order to make it to the destination. You need not have any food or water left when you arrive at the destination. Since the general store sells food only in whole units and has only one million food units available, the amount of food you should buy will be an integer greater than zero and less than or equal to one million.
Input:
The first line of input in each trial data set contains n (2 = n = 20), which is the total number of significant locations in the desert, followed by an integer that is your total carrying capacity in units of food and water. The next n lines contain pairs of integers that represent the coordinates of the insignificant locations. The first significant location is the starting point, where your food supply mustbe purchased; the last significant location is the destination; and the intervening significant locations(if any) are oases. You need not visit any oasis unless you find it helpful in reaching your destination,and you need not visit the oases in any particular order.
The input is terminated by a pair of zeroes.
Output:
For each trial, print the trial number followed by an integer that represents the number of units of food
needed for your journey. Use the format shown in the example. If you cannot make it to the destination
under the given conditions, print the trial number followed by the word “Impossible.”
Place a blank line after the output of each test case.
Sample Input
4 100
10 -20
-10 5
30 15
15 35
2 100
0 0
100 100
0 0
Sample Output
Trial 1: 136 units of food
Trial 2: Impossible
0 Answer(s)