Mr. Whitacre is having a lot of fun assaying with his choir. However, it is a bit late and he will have to go home sooner or later. Furthermore, it is starting to snow and the streets are getting worse by the minute. How much time can Mr. Whitacre enjoy before departing?
Let us model the city as an undirected graph with vertices (street crosses, numbered from 0) and edges (streets). Mr. Whitacre is currently at vertex 0, and he has to reach vertex (home). The cost to traverse each street is , where denotes the time when Mr. Whitacre starts traversing that street. For instance, if he starts walking that street right now, the time to traverse it is just . Mr. Whitacre must be at home at most at time .
Input is all integer numbers, and consists of several cases, each with , and , followed by the information of the streets . Assume , , , , that between two vertices there is no more than one edge, and that and are between 0 and .
For every case, print the maximum choir assay time with three digits
after the decimal point. If it is impossible to reach home at time
,
print “impossible”. The input cases have no precision
issues.
Input
2 1 10 0 1 2 3 3 1 1000 1 2 0 0 5 5 100 4 0 10 0 0 3 2 10 2 4 1 5 4 3 1 20 3 2 0 10
Output
2.333 impossible 10.000