Find the weight of minimum spanning tree for a weighted undirected connected graph.
The first line contains the numbers and , where is the number of vertices in the graph and is the number of edges. Each of the next lines contains a triple of integers , where and are the numbers of vertices connected by an edge and is the weight of edge (a positive number not exceeding ).
Print the weight of minimum spanning tree.