King Manuel V is the newly-appointed king of an archipelago. This archipelago consists of islands, all of which are under his reign. Each pair of islands is connected by at most one bridge. The set of bridges in King Manuel V's archipelago is what its citizens would call tourist-friendly. A set of bridges in an archipelego is said to be tourist-friendly if it is always possible for a tourist starting from an island to travel to any other island in the archipelago solely by crossing a combination of the bridges.

During his climb to glory, King Manuel V has already made a lot of enemies. But of course, it would be messy to start an all-out war with the other kingdoms. Thus, he vents out his frustration by burning bridges. Yes, he is the type of person who literally burns bridges.

Now, King Manuel V wants to burn as many bridges as he can but still retain the archipelago's tourist-friendly status. Should there be more than one way to do this, he should burn the set of bridges with the cheapest total cost.

How much damage (financially) will this bridge-burning spree cause?

Input Format
The first line of input contains two positive integers and , in that order, which represents the number of islands and bridges, respectively. For simplicity, we number the islands from to .

The next lines then describe each of the bridges. Each of these lines consist of three positive integers: , , and . This tells us that islands and are connected by a bridge. Moreover, the cost for the construction of this bridge was .

Note: You may assume that the initial set of bridges is tourist-friendly.

Output Format
You must output the damage (the sum of the costs of the bridges burned) which King Manuel V would cause if he burns the bridges following the method described above.

Constraints





Sample Input

5 6
1 2 100
2 3 90
1 3 80
3 5 10
4 3 15
5 4 5

Sample Output

85

Explanation
It can be shown that the king can only burn at most two bridges. Burning any more than that will cause the kingdom to lose its tourist-friendly status. The cheapest set of two bridges to burn that will keep the kingdom tourist-friendly is the bridge connecting islands 1 and 3, and the bridge connecting islands 5 and 4. These bridges cost 80 and 5, respectively.

See the following image for illustration: image

Line: 1 Col: 1
  1. Challenge Walkthrough
    Let's walk through this sample challenge and explore the features of the code editor.1 of 6
  2. Review the problem statement
    Each challenge has a problem statement that includes sample inputs and outputs. Some challenges include additional information to help you out.2 of 6
  3. Choose a language
    Select the language you wish to use to solve this challenge.3 of 6
  4. Enter your code
    Code your solution in our custom editor or code in your own environment and upload your solution as a file.4 of 6
  5. Test your code
    You can compile your code and test it for errors and accuracy before submitting.5 of 6
  6. Submit to see results
    When you're ready, submit your solution! Remember, you can go back and refine your code anytime.6 of 6
  1. Check your score