You are the president of a country with $$$n$$$ cities numbered from $$$1$$$ to $$$n$$$. This year, your country will be the host of a famous race!
Your country is connected with exactly $$$n-1$$$ roads, and each road has a length. It is possible to drive from any city to any other city using these roads.
A track is a sequence $$$a_1,a_2,\dots,a_k$$$ of $$$k \geq 2$$$ cities, such that city $$$a_i$$$ and city $$$a_{i+1}$$$ for $$$1 \leq i \leq k-1$$$ are connected by a road. The length of a track is the sum of lengths of each road in that track.
To organize the race, you must select a set of tracks such that every road is in exactly one track. This means, in particular, that no two tracks share the same road.
However, according to the car sports committee, all tracks must have the same length. However, this year they'll make an exception and consider the proposal based on the difference between the largest and shortest track.
What is the minimum possible difference between the largest and shortest track?
The first line contains an integer $$$n$$$ ($$$2 \leq n \leq 40$$$), denoting the number of cities. The next $$$n$$$ lines contain three integers $$$a_i$$$,$$$b_i$$$,$$$w_i$$$ ($$$1 \leq a, b \leq n$$$, $$$1 \leq w_i \leq 10^9$$$), indicating a road between cities $$$a_i$$$ and $$$b_i$$$ with length $$$w_i$$$.
A single integer, containing the minimum possible difference between the largest and shortest track.
41 2 12 3 23 4 3
0
61 2 122 3 52 4 75 6 96 4 5
2
| Name |
|---|


