There are n cities and there are roads in between some of the cities. Somehow all the roads are damaged simultaneously. We have to repair the roads to connect the cities again. There is a fixed cost to repair a particular road. Find out the minimum cost to connect all the cities by repairing roads.
Input Format
First line contains number of cities. Second line contains number of edges roads. Each of next E lines contain 3 number u and v and c denoting a road between u and v with cost c to repair.
Output Format
print the minimum cost.
Constraints
1<= n <= 1000 1<= e <= n*(n-1)/2
Example
Input
7 8 0 1 10 1 2 10 2 3 10 0 3 40 3 4 2 4 5 3 5 6 3 4 6 8
Output
38