"Title description"
Give a direction-free graph with a starting point of 1 ending to n, each side having a length, and starting from the beginning to reach all points, all points can also reach the end point. The mung bean frog starts from the starting point and goes to the end.
At each vertex, if there is a road where K leaves the point, the mung bean Frog can choose any route to leave the point, and the probability of going to each road is 1/k.
Now mung bean frog want to know, from the starting point to the end of the path through the total length of the expectation is how much.
"Input description"
The first line: two integers n, m, representing the graph has n points, M edge;
The second line to line 1+m: 3 integers A, B, c for each line, representing a forward edge with a length of C from a to B.
"Output description"
The expected value of the total length from the starting point to the end path, rounding retains two decimal places.
"Sample Input"
4 4
1 2 1
1 3 2
2 3 3
3 4 4
"Sample Output"
7.00
"Data range and Tips"
For 20% data: N <= 100;
For 40% data: N <= 1000;
For 60% data: N <= 10000;
For data of 100%: N <= 100000,m<=2*n.
The fate of mung bean frog