ADAROADS - Ada and Roads

no tags

As you might already know, Ada the Ladybug is a farmer. She grows many fruits and vegetables. She has to take care of them so she builds many roads between them. She also doesn't want to keep unnecessary roads so after builting a road she cleans the rest of roads so her road-system doesn't contain any needless cycles. Each road has some maintenance cost and she always keeps roads in such ways that the total cost is minimized.

Harsh warning: I'm verry sorry but I don't (currently) have tester, so the only one who tested the correctness was me myself (so there is big chance of problem being wrong). In this case I apologize (this warning will be withdrawn as soon as Blue.Mary will get AC :P ).

Input

The first line of input containts 1 ≤ N ≤ 2*105, 0 ≤ M ≤ 5*105, the number of vegetables and the number of roads built by Ada.