logo AlgoBeat OnlineJudge
登录 注册

#217590. [ICPC 2019 Yinchuan R] Toad's Travel

内存限制:512 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

A toad is travelling in Byteland, which consists of some cities and some roads, each of which connects a pair of cities. More specifically, the map of Byteland is an undirected connected edge-weighted graph in which every edge lies on at most one simple cycle. The toad is in the city numbered by at first and wants to go through all the roads at least once.

TIME IS MONEY!

The toad must minimize the total length of the path in his travelling.

输入格式

The first line contains two integers , indicates the number of cities and roads in Byteland.

Each of the next lines contains three integers , representing a road with a length of connects and . It's guaranteed that each pair of cities will be connected with at most one road.

输出格式

Output a single integer, indicating the minimum possible sum.

样例

样例输入 1

6 7
1 2 1
1 3 1
2 3 1
3 4 1
3 5 1
4 5 1
2 6 1

样例输出 1

8

数据范围与提示

In the sample test, one of the best paths is

and the total length of the path is .