- Time limit: 1.00 s
- Memory limit: 512 MB
Consider a directed weighted graph having nodes and edges. Your task is to calculate the minimum path length from node to node with exactly edges.
Input
The first input line contains three integers , and : the number of nodes and edges, and the length of the path. The nodes are numbered .
Then, there are m lines describing the edges. Each line contains three integers , and : there is an edge from node to node with weight .
Output
Print the minimum path length. If there are no such paths, print .
Constraints
Example
Input:
3 4 8 1 2 5 2 3 4 3 1 1 3 2 2
Output:
27