Tourist Information Points

No attempts yetTime limit1sMemory limit256 MB

Problem

King Byteasar wants the sights of Byteotia to draw crowds of tourists who spend a lot of money that eventually reaches the royal treasury. Reality falls short of his dream. The king told his councilor to look into it, and the councilor found that foreigners stay away from Byteotia because its road network is sparse.

Byteotia has nn towns joined by mm two-way roads, and every road links two different towns. Some roads run over flyovers or through tunnels. There is no guarantee that every town can be reached from every other town.

The councilor also observed that the current road network allows no long journey. Wherever you start, you cannot visit more than 10 towns without passing through some town twice.

The treasury cannot pay for new roads, so Byteasar decided to build tourist information points (TIPs) instead, staffed by officers who advertise the short trips that are available. For each town there must be a TIP either in that town or in one of the towns linked to it by a road. The cost of building a TIP is known for each town. Find the cheapest way of building TIPs that satisfies the condition.

Input

The first line contains two integers nn and mm separated by a single space (2n200002 \le n \le 20000, 0m250000 \le m \le 25000), the number of towns and the number of roads in Byteotia. The towns are numbered from 1 to nn.

The second line contains nn integers c1,c2,,cnc_1, c_2, \dots, c_n separated by single spaces (0ci100000 \le c_i \le 10000), where cic_i is the cost of building a TIP in town ii.

Each of the next mm lines describes one road. The ii-th of these lines contains two integers aia_i and bib_i separated by a single space (1ai<bin1 \le a_i < b_i \le n), which means that towns aia_i and bib_i are linked by a road. There is at most one road between any pair of towns.

In tests worth 20% of the total score, n20n \le 20 holds.

Output

Print one integer on a single line: the total cost of building all the TIPs.

Hint

In the first example the cheapest choice is to build TIPs in towns 1, 5, and 6, at a cost of 3+2+2=73+2+2=7.