A group of divers is exploring a cave. To get out, every diver has to swim under a large rock, and swimming under the rock requires the single electric torch they all share. The passage under the rock is narrow, so at most two divers can swim under it at the same time.
The divers leave the cave by repeating this pattern until everyone is out:
Each diver swims at a constant pace. When two divers swim together they move at the pace of the slower one, so a crossing by two divers takes the larger of their two times. A single diver swimming back takes that diver's own time.
Some pairs of divers dislike each other and refuse to swim under the rock together, so such a pair can never cross as a couple.
Find the shortest total time in which all divers can get out of the cave, or report that it is impossible.
The first line contains two integers n and m (2≤n≤100000, 0≤m≤min(100000, n(n−1)/2)): the number of divers and the number of disliking pairs.
The second line contains n space-separated integers t1,t2,…,tn (1≤ti≤500000000), where ti is the time diver i needs to swim under the rock.
Each of the next m lines contains two integers a and b (1≤a,b≤n, a=b): a pair of divers who dislike each other and will not swim under the rock together. Each unordered pair {a,b} appears at most once.
Print a single integer: the shortest total time in which all divers can get out of the cave. If it is impossible for all of them to get out under these rules, print the word IMPOSSIBLE instead.