beecrowd | 2225

Penalization

By Thalyson Nepomuceno, UECE BR Brazil

Timelimit: 1

In the game Pomekon, one of the goals is to visit real places to get new items and experience. Fulyane does not like to leave the house, she made a program that simulates its location, providing false coordinates of her location to the game. She also made a romote control that allows to move with fake coordinates, pretending as if she were really walking, but without leaving home.

Searching forums, she found that for not to be banned from the game, she would have to move using only the real routes, but also found that he could move instantly from one place to another, without using real routes no more than K times per day, because if she to teleport more than K times, she could be banned from the game forever.

Fulyane always starts at the location identified by the index 1, and wants to visit the all locations, using the teleport no more than K times.

Input

The input contains several instances. The first line of input contains an integer T indicating the number of instances. The first line in each instance contains three integers N (1 ≤ N ≤ 15), M (1 ≤ MN2) and K (0 ≤ K ≤ 5) representing respectively the number of locations, number of routes and the amount maximum allowable of teleporters. Then, follows M lines, each line containing three integers A, B and C (1 ≤ C ≤ 30000), representing respectively that the location A is connected with the location B by a route, and Fulyane takes C minutes to get from A to B using this route.

Output

For each instance, print the minimum amount of minutes that Julyane takes to visit all locations, using no more than K teleporters. If you can not visit all places, print -1.

Input Sample Output Sample

2
3 2 0
1 2 3
1 3 2
5 4 0
4 3 16
3 3 13
5 2 15
2 4 20

7
-1