Under construction

Still being built. Things may change

Hypno

Time limit2sMemory limit512 MB

Summary
Find the minimum expected time to walk from intersection 1 to intersection n when each road may put you to sleep with a Hypno you are susceptible to, and you learn each road's result after trying it.
Level

Hard9 of 10

Topics
Graph, Shortest path, Probability
Solved
No attempts yet

Statement

You have just heard that a new PokéStop has opened somewhere in your city. You want to go there and collect the items it offers. The city has nn intersections connected by mm bidirectional roads, numbered from 1 to nn. You are at intersection 1, and the PokéStop is at intersection nn. Crossing any road takes one minute.

Each road has a single Hypno. When you reach the midpoint of a road, the Hypno uses its psychic power on you, and you fall into a very short sleep. The Hypno then makes you sleepwalk to a random endpoint of that road. After one minute, you are at the opposite end with probability 12\frac{1}{2}, or back at the same intersection otherwise.

You are immune to each individual Hypno with probability 12\frac{1}{2}. If the road you are on has a Hypno you are immune to, you always cross the road safely in one minute. If it has a Hypno you are susceptible to, you fall asleep on every crossing of that road. You do not know initially which roads have which Hypno, but after you attempt to cross a road, you know which endpoint you are currently at. What is the minimum expected time to reach the PokéStop at intersection nn?

Input

The first line contains two integers nn and mm (2≤n≤2000002 \le n \le 200000, 1≤m≤2000001 \le m \le 200000), the number of intersections and the number of roads. Each of the next mm lines contains two integers aa and bb (1≤a,b≤n1 \le a, b \le n, a≠ba \ne b), the intersections connected by a road. No two intersections are connected by more than one road. The city is connected, so you can reach every intersection from every other intersection.

Output

Print a single real number, the minimum expected time to reach intersection nn. Your answer is correct if its absolute or relative error does not exceed 10−910^{-9}.

Hint

In the first sample, the optimal strategy is to repeatedly try to go directly to the destination using the second road. With probability 12\frac{1}{2}, you are immune to the Hypno on that road and reach the destination in 1 minute. Otherwise, you are susceptible, and the expected time in that case is 12⋅1+14⋅2+18⋅3+116⋅4+⋯=2\frac{1}{2} \cdot 1 + \frac{1}{4} \cdot 2 + \frac{1}{8} \cdot 3 + \frac{1}{16} \cdot 4 + \cdots = 2. The overall expected time is 12⋅1+12⋅2=32\frac{1}{2} \cdot 1 + \frac{1}{2} \cdot 2 = \frac{3}{2}.

In the second sample, repeatedly trying the second intersection takes 3 minutes in expectation. Trying only the third intersection also takes 3 minutes. A better strategy exists.

Examples2

  1. Example 1

    Input
    3 3
    1 2
    1 3
    2 3
    
    Expected output
    1.500000000000
    
  2. Example 2

    Input
    4 4
    1 2
    2 4
    4 3
    3 1
    
    Expected output
    2.875000000000