406269: GYM102341 H Hypno

Memory Limit:512 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

H. Hypnotime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard output

You've just heard that somewhere in your city a new PokéStop has opened. You obviously want to go there and obtain the items available there. The city consists of $$$n$$$ intersections connected by $$$m$$$ bidirectional roads. The intersections are numbered with integers from $$$1$$$ to $$$n$$$. You are currently at the first intersection and the PokéStop is at the $$$n$$$-th one. It takes one minute to cross each road. How fast can you reach the PokéStop?!

Uh, not so fast. On each road, there is a single Hypno, ready to use its psychic powers on you as soon as you reach the midpoint of the road. As soon as it happens, you fall into a very short sleep. Hypno then makes you sleepwalk to the random endpoint of the road you're on. Therefore, after one minute, you'll be at the opposite end of the road with $$$\frac12$$$ probability, or back at the same intersection otherwise.

Here's a thing, though: you're immune to each individual Hypno with $$$\frac12$$$ probability. If a road you're on contains a Hypno you're immune to, you'll always safely cross the road in one minute. If a road contains a Hypno you're susceptible to, you'll fall asleep on each crossing of that road. You don't initially know which roads contain which Hypno, but after making an attempt to cross some road you know at which endpoint you currently are. What is the minimum expected time in which you can reach the PokéStop?

Input

The first line contains two integers $$$n$$$, $$$m$$$ ($$$2 \le n \le 200\,000$$$, $$$1 \le m \le 200\,000$$$) — the number of intersections in your city and the number of bidirectional roads connecting them. Each of the following $$$m$$$ lines contains two integers $$$a, b$$$ ($$$1 \le a, b \le n$$$, $$$a \neq b$$$) — the indices of the intersections connected by the road.

No two intersections are connected by multiple roads. The city is connected, that is, you can reach each intersection from any other intersection, possibly using multiple roads.

Output

Print a single real number — the minimum expected time you need to reach the PokéStop at intersection $$$n$$$. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-9}$$$.

ExamplesInput
3 3
1 2
1 3
2 3
Output
1.500000000000
Input
4 4
1 2
2 4
4 3
3 1
Output
2.875000000000
Note

In the first sample test, the optimal strategy is to repeatedly try to go directly to the destination using the second road. With $$$\frac12$$$ probability, you are immune to Hypno which is standing on that road and you can reach the destination in time $$$1$$$. On the other hand, you are susceptible with $$$\frac12$$$ probability, and we can show that in this case you'll reach the destination in expected time $$$2 = \frac12 \cdot 1 + \frac14 \cdot 2 + \frac18 \cdot 3 + \frac1{16} \cdot 4 + \cdots$$$. Therefore, the overall expected time is $$$\frac12 \cdot 1 + \frac12 \cdot 2 = \frac32$$$.

In the second sample test, if you repeatedly tried to go through the second intersection, your expected time would be equal to $$$3$$$ minutes. The same if you only tried to go through the third intersection. There exists a strategy to achieve a better expected time.

Here are the illustrations of both sample tests:

加入题单

算法标签: