Following Flow

No attempts yetTime limit1sMemory limit8 MB

Problem

The world has N+1N+1 vertices, numbered 00 through NN. Edges run between the vertices. Every edge is one way, and each edge takes its own amount of time to cross. Donghyun is standing at vertex 00, and vertex NN is his home.

Until he reaches home, Donghyun wanders wherever the mood takes him. Wandering means that he picks one of the edges leaving his current vertex, each with the same probability, and follows it to the next vertex. When several edges join the same pair of vertices, each one counts as a separate edge. An edge that returns to its own vertex is also possible. Once he arrives at vertex NN, he stops there.

Compute the expected time it takes him to get from vertex 00 to his home.

For example, suppose the world looks like the picture below.

At vertex 00 Donghyun spends time 11 to move to vertex 11 with probability 1/21/2, or spends time 11 to move to vertex 22 and reach home. At vertex 11 he spends time 22 to return to vertex 00 with probability 1/21/2, or spends time 22 to reach home. The answer in this case is

12×1+(12)2×(1+2)+(12)3×(1+2+1)+=83\frac{1}{2}\times 1+\left(\frac{1}{2}\right)^{2}\times(1+2)+\left(\frac{1}{2}\right)^{3}\times(1+2+1)+\cdots=\frac{8}{3}

Input

The first line has NN (1N30)(1 \le N \le 30), the number of vertices, and MM (1M1000)(1 \le M \le 1\,000), the number of edges, separated by a space. Note that the real number of vertices is N+1N+1.

Each of the next MM lines has xx, yy, tt (0x<N, 0yN, 1t50)(0 \le x < N,\ 0 \le y \le N,\ 1 \le t \le 50) separated by spaces, meaning that an edge runs from vertex xx to vertex yy and takes time tt to cross. The edges are given so that every vertex has a path to vertex NN. Every vertex from 00 to N1N-1 therefore has at least one outgoing edge.

Output

Print on one line the expected time to get from vertex 00 to home, vertex NN, rounded to exactly six digits after the decimal point. Print all six digits even when the value is an integer. The answer never exceeds 10610^{6}, and no input makes the rounding at the sixth decimal digit ambiguous.