K. Kaktus Kourse
time limit per test
15 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Huge cacti in the Hortus botanicus in Leiden.

Before entering the contest site, you decide to wander around in the Hortus botanicus in Leiden. You come across some huge cacti. After walking some more, you decide to take a look at a map of the Hortus botanicus, and figure that all the walking routes can be modelled as a graph. Each route connects two different intersections and can be represented by an edge with some length. After investigating the map, you come to a delightful conclusion: the graph of the garden is a cactus graph! From a graph theory course you once took, you remembered the definition:

Def. Cactus graph: A connected, simple, undirected graph is a cactus graph if every edge lies on at most one cycle.

Having fallen for the Hortus botanicus, you want each of your $$$k$$$ friends to enjoy it too, so you will plan a personal Kaktus Kourse for every one of them.

You start a Kourse at one intersection of the garden and walk along the routes to a different intersection, never visiting the same intersection twice (repetition would bore your friends). Its length is the total length of the routes traversed. A Kourse is described by the sequence of intersections visited, in order: two Kourses are different if their sequences differ. In particular, walking a Kourse backwards gives a different Kourse.

Every friend must receive a different Kourse, and you want even the shortest one handed out to be as long as possible. What is the largest possible length of the shortest Kourse you give out? If the garden has fewer than $$$k$$$ distinct Kourses, output "impossible".

An illustration of sample $$$1$$$. The cactus graph mostly matches the actual map of the Hortus botanicus Leiden, but with some minor routes left out. All the cycles of the cactus graph are drawn in different colours. Two cycles can share an intersection, but never a route.
Input

The input consists of:

  • One line with three integers $$$n$$$, $$$m$$$, and $$$k$$$ ($$$2 \leq n \leq {100}$$$, $$$ n-1 \leq m \leq {100}$$$, $$$1 \leq k \leq {10^{18}}$$$), the number of intersections, number of routes in the map of the Hortus botanicus, and the number of friends.
  • $$$m$$$ lines, each with three integers $$$u$$$, $$$v$$$, and $$$w$$$ ($$$1\leq u \lt v \leq n$$$, $$$1 \leq w \leq {10^9}$$$), indicating there is a route between intersection $$$u$$$ and intersection $$$v$$$ of length $$$w$$$.
It is guaranteed that the graph in the input is a cactus graph. Therefore, it is connected, contains no multi-edges (no pair $$$(u,v)$$$ is listed more than once), and no two different cycles share a route.
Output

If the garden has fewer than $$$k$$$ distinct Kourses, output "impossible". Otherwise, output the length of the shortest Kourse handed out to one of your friends.

Examples
Input
12 14 5
2 3 12
2 5 22
3 4 13
4 5 10
5 6 10
5 8 21
6 9 23
8 9 9
10 11 21
10 12 17
11 12 47
1 2 10
6 7 10
9 10 45
Output
190
Input
3 3 3
1 2 1
2 3 2
1 3 4
Output
5
Input
4 3 1
3 4 1000000000
1 2 1000000000
2 3 1000000000
Output
3000000000
Input
4 3 12
1 2 1000000000
3 4 1000000000
2 3 1000000000
Output
1000000000
Input
4 3 13
1 2 1000000000
2 3 1000000000
3 4 1000000000
Output
impossible