#Lutece2077. 子丑寅卯辰巳午未申酉戌亥

子丑寅卯辰巳午未申酉戌亥

Migrated from Lutece 2077 子丑寅卯辰巳午未申酉戌亥

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

一个有NN个点的无向连通图,有MM条无向边,每条边有边权CC,请你删除MN+1M-N+1条边,使剩下的N1N-1条边形成一棵树,求这MN+1M-N+1条边的最小边权和。

Input

第一行两个整数N,MN,M,分别表示点和边的个数。

接下来MM行,每行三个整数u,v,cu,v,c,表示一条由uu连向vv的无向边,边权为cc.

输入保证没有重边和自环。

$(1<=N<=100000,N-1<=M<=min(100000 , \frac{n(n-1)}{2}),1<=u,v<=N,1<=c<=10000)$

Output

求删除的MN+1M-N+1条边的最小边权和。

Samples

4 4
1 2 1
2 3 2
3 4 3
4 1 4
1