Minimal Spanning Tree#3835

Minimal Spanning Tree

1 second
128 megabytes
Very easy

The connected graph is given. Find the spanning tree of minimal weight.

Input

The first line contains two integers and (1 \leq n \leq 20000, 0 \leq m \leq 100000) - the number of vertices and number of edges in a graph. Each of the next lines describes one edge. The edge number is given with three integers b_i, e_i and w_i (1 \leq b_i, e_i \leq n, 0 \leq w_i \leq 100000) - the numbers of vertices and its weight.

Graph is connected.

Output

Print one number - the weight of the minimal spanning tree.

Examples

Example 1

Loading
Loading