Global Warming

The friendships form a disjoint union of cliques, so each connected component of even size must be split into a perfect matching of minimum total cost.

Medium6GraphDynamic programmingCombinatoricsSortingNo attempts yetTime limit5sMemory limit512 MB

Problem

John teaches middle school, and he spends this whole week teaching his nn students about the causes and effects of global warming. For homework he asks them to prepare presentations on global warming, and to make the work lighter he lets them prepare it in groups of two.

Arranging the groups comes with one restriction: only students who are friends are willing to work together. Luckily the friendships in this class satisfy the following property. For three distinct students pp, qq and rr, if pp and qq are friends and qq and rr are friends, then pp and rr are friends as well.

The students work at home, so a student has to travel to meet a partner, and the trip emits carbon dioxide depending on the mode of transportation. John asked every student to find out how much carbon dioxide a meeting with each of their friends would emit.

Find the smallest total amount of carbon dioxide emitted when all students are split into groups of two friends, or report that no such arrangement exists.

Input

The first line contains the number of students nn and the number of friend pairs mm (1n2001 \le n \le 200, 0m2500 \le m \le 250). Students are identified by distinct numbers from 11 to nn.

Each of the next mm lines contains three integers pp, qq and cc (1p,qn1 \le p, q \le n, pqp \ne q, 0c1060 \le c \le 10^6). Here pp and qq are the numbers of two distinct students who are friends, and cc is how many grams of carbon dioxide are emitted when those two are in a group together and have to meet. Every pair of friends is listed exactly once.

Output

Print the total amount of carbon dioxide, in grams, emitted by an optimal arrangement of all students into groups of two friends. If no such arrangement exists, print impossible.