
She usually gets them on the way from home to university just before training. The bicycle network in her home town consists of intersections which are connected by cycleways of different lengths. The intersections are numbered from $$$1$$$ to $$$n$$$. Karlijn's house is at intersection $$$1$$$, and her university is at intersection $$$n$$$.
There are multiple stores that sell kruidnoten, but some of them are often out of stock. Karlijn wants to get to university as quickly as possible, so she has a habit of looking up online which stores still have kruidnoten before leaving her house. Using this information, she then takes the shortest path via some stocked store. An example is visualized in Figure K.1.
Figure K.1: A possible situation from Sample Input 1, where not every store is stocked with kruidnoten. In this case, Karlijn buys the kruidnoten at the store at intersection $$$3$$$, and the shortest path has length $$$11$$$. Now, she wonders how much time she should usually plan for her way to training. From long-time experience, Karlijn knows for each store how likely it is that they have not sold out. In particular, she observed that the stock of kruidnoten is independent for each store. What is the expected length of a shortest path from Karlijn's house to university if she wants to visit some store that has kruidnoten in stock?
The input consists of:
If the event that Karlijn cannot get any kruidnoten on her way has probability $$$ \gt 0$$$, output "impossible". Otherwise, output the expected length of a shortest path from her home to university if she gets kruidnoten on the way.
Your answer should have an absolute or relative error of at most $$$10^{-6}$$$.
5 5 3 1 2 6 3 1 4 4 5 2 1 4 1 3 4 5 2 1.0 3 0.4 5 0.1
12.36
6 5 2 1 2 1 1 3 1 4 5 3 5 6 1 6 3 2 1 0.6283 4 0.3142
impossible