**1 人解决**，1 人已尝试。

**4 份提交通过**，共有 4 份提交。

**8.9** EMB 奖励。

**单点时限: **2.0 sec

**内存限制: **1024 MB

This is a very exciting week for John. The reason is that, as a middle school teacher, he has been asked to dedicate the entire week to teaching his class of students about the cause and effect of global warming. As John is very passionate about his planet, he’s going to spend extra time and effort to make this week memorable and rewarding for the students. Towards that, one of the things he wants to ask them to do is to prepare, as homework, presentations about global warming. To make this a little easier for them, as well as more fun, he has asked them to do this in groups of two.

Of course arranging the students into groups comes with the usual headache, namely that only friends are willing to work together. Luckily the students in his class are a friendly bunch. In particular, if , and are three distinct students, and and are friends, and and are friends, then and are also friends. But John now realizes the irony in asking his students to work at home in groups, as students may have to travel to meet their group partner, which may emit greenhouse gases such as carbon dioxide, depending on their mode of transportation. In the spirit of this week’s topic, John asked all the students in his class to calculate, for each of their friends, how much carbon dioxide would be emitted if they were to meet up with the respective friend.

Using this information, can you help John figure out what is the minimum total amount of carbon dioxide that will be emitted if he arranges the groups optimally, or determine that it’s not possible to arrange all the students into groups of two friends?

The first line contains two integers and (, ), the number of students in John’s class, and the total number of pairs of friends in the class. As John is bad with names, he has given each of his students a distinct integer identifier between and .

Each of the next lines contains three integers , and (, ), the identifiers of two distinct students that are friends, and how many grams of carbon dioxide would be emitted if they were in a group together, and thus had to meet. Each pair of friends is listed exactly once in the input.

Output the minimum total amount of carbon dioxide, in grams, that would be emitted if John arranges all students optimally into groups of two friends, or `impossible`

if there is no way to arrange the students into groups in that way.

Input

5 4 3 1 375 2 5 283 1 4 716 3 4 98

Output

impossible

Input

6 7 5 6 600 2 5 200 3 5 400 6 3 500 1 4 300 3 2 400 6 2 200

Output

900

**1 人解决**，1 人已尝试。

**4 份提交通过**，共有 4 份提交。

**8.9** EMB 奖励。

题目标签