E

Where to Run

Input

Standard Input

Output

Standard Output

 

D:\Documents\Programming\Contest\Contest - DIU 2010\Where to Run\robber.pngLast night you robbed a bank but couldn’t escape and when you just got outside today, the police started chasing you. The city, where you live in, consists of some junctions which are connected by some bidirectional roads.

Now since police is behind, you have nothing to do but to run. You don’t know whether you would get caught or not, but if it is so, you want to run as long as you can. But the major problem is that if you leave a junction, next time you can’t come to this junction, because a group of police wait there for you as soon as you left it, while some other keep chasing you.

That’s why you have made a plan to fool the police as longer time as possible. The plan is, from your current junction, you first find the number of junctions which are safe (no police are there) and if you go to one of them; you are still able to visit all the safe junctions (in any order) maintaining the above restrictions. You named them ‘Elected Junction’ or EJ. If there is no such junction; you stop running, because you lose your mind thinking what to do, and the police catch you immediately.

But if there is at least one EJ, you can either fool around the police by staying in the current junction for 5 minutes (actually you just hide there, so the police lose your track thinking which road you might have taken), or you can choose to go to any EJ. The probability of choosing to stay in the current junction or to go to each of the EJ is equal. You can fool the police (by hiding) multiple times in a city, but of course the above conditions should be satisfied. And you have decided not to stop in the middle of any road, because you have the fear that, if you stop in the middle of any road, then the police would surround you from both ends.

Now, given the map of the city and the required time for you to travel each road of the map; you have to find the expected time for the police to catch you.

 

Input

Input starts with in integer T (≤ 100) denoting number of cases.

Each case starts with a blank line. Next line contains two integers n (1 ≤ n ≤ 15) denoting the number of junctions and m, denoting the number of roads in the city. The junctions are numbered from 0 to n - 1.

Each of the next m lines contains three integers u v w (0 ≤ u, v < n and 0 < w ≤ 100 and u ≠ v) meaning that there is a road between junction u and v and you need w minutes to travel the road. Your home is in junction 0 and you are initially in your home. And you may safely assume that there can be at most one road between a pair of junctions.

Output

For each case, print the case number and the expected time in minutes. Errors less than 10-5 will be ignored.

 

Sample Input

Sample Output

3
 
3 2
0 1 3
1 2 3
 
4 6
0 1 75
0 2 86
0 3 4
1 2 1
1 3 53
2 3 10
 
5 5
0 1 10
1 2 20
2 3 30
1 3 20
3 4 10
Case 1: 16
Case 2: 106.8333333333
Case 3: 90

 


Problemsetter: Jane Alam Jan, Special Thanks: Sohel Hafiz