Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

EIDISCENTER - Distribution Center

ABC company is doing a research to turn one of their n warehouses into a distribution center. These warehouses are connected by n-1 path (connected to other warehouses). Each path has a length. Your task is to find that distribution center so that the total length from the center to other warehouses is  minimum.

Input

The first line contains the number of warehouses n (1 ≤ n ≤ 105)

Each of the next n lines contains 3 integers: u, v representing an edge between u and v (0 ≤ u,v ≤ n) and l representing length of uv (l ≤ 105).

Output

Print out a the minimum total length.

Sample

 

Input

Output

0 1 5

1 2 1

2 3 3

1 4 2


12


Added by:Ha Minh Ngoc
Date:2022-12-25
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:CSHARP C++ 4.3.2 CPP CPP14 CPP14-CLANG FSHARP GO JAVA JS-MONKEY NODEJS PHP PYTHON PYPY PYPY3 PYTHON3 RUBY SQLITE SWIFT VB.NET
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.