There are islands. There can be a maximum of two bridges(both bidirectional) connecting a pair of islands. Every bridge has a maintenance cost. You have to reduce the cost of maintenance as much as possible by breaking some of these bridges because a broken bridge does not need any maintenance. The bridges should be broken in such a way that any pair of islands should be reachable from each other. What is the maximum cost which can be reduced?
You are given the maintenance cost of each bridge in the form of array. . is the maintenance cost of one of the bridges between and islands.
Note
Input format
Output format
Constraints
Maintenance cost of each bridge
There are two bridges between island 1 and 2 of maintenance cost . So, the bridge with cost can be broken. So maintenance cost of can be reduced.