Techboy is appointed as the minister of roads and highway in his country Better-Not-Name-It. Now he wants to visit all the cities of his country to know more about the current condition of the roads. But as he is a very lazy person he wants to travel as little as possible. He wants to visit all the cities at least once.
All the cities in the country Better-Not-Name-It are numbered from 1 to . Currently, Techboy is in the city numbered 1. He will start his journey from this city and can end in any city of his country, but he will visit all the cities at least once. He wants to travel the minimum possible distance. Now help Techboy find the minimum distance he needs to travel.
Input starts with an integer (), denoting the number of test cases. The first line contains a single integer (), representing the number of cities in the country. The next lines contain 3 integer numbers each , () and (). and are the two ends of a road and and is the length of that road.
For each test case, print a line where is to be replaced by the test case number and is to be replaced by the minimum distance Techboy needs to travel.
Input | Output |
---|---|
2 3 1 2 3 2 3 4 3 1 2 3 1 3 3 | Case 1: 7 Case 2: 9 |