Problem: Escape

An undirected graph with positive values ​​at the vertices is given. The vertices are numbered from 1 to N, and the i-th vertex has a value of w_i. You can start from the first vertex and move on the graph with the constraint that you cannot pass the edge that you just passed. At each vertex, you can get the score of the value that the vertex has only when you visit it for the first time.

Find the maximum sum of the points you can get.

Constraints

* 1 ≤ N ≤ 100000
* N − 1 ≤ M ≤ 100000
* 1 ≤ w_i ≤ 1000
* 1 ≤ u_i, v_i ≤ N
* There are no multiple edges or self edges
* The graph is concatenated



Input Format

Input is given from standard input in the following format.


N M
w_1 w_2 ... w_N
u_1 v_1
u_2 v_2
...
u_M v_M


In the first line, the number of vertices N of the graph and the integer M representing the number of edges are entered.
The value w_i of each vertex is entered in the second line.
In addition, the number of the two vertices connected by each side is entered in the M line.


Output Format

Print the answer on one line.

Sample Input 1


6 6
1 2 3 4 5 6
1 2
twenty three
3 4
14
4 5
5 6


Sample Output 1


twenty one


<image>
You can collect the points of all vertices by going from vertices 1 → 2 → 3 → 4 → 5 → 6.

Sample Input 2


7 8
1 3 3 5 2 2 3
1 2
twenty three
3 1
14
1 7
1 5
1 6
5 6


Sample Output 2


16


<image>
You can collect 16 points by going from vertices 1 → 2 → 3 → 1 → 5 → 6 → 1 → 4.





Example

Input

6 6
1 2 3 4 5 6
1 2
2 3
3 4
1 4
4 5
5 6


Output

21

Solution (in CPP):

Solution:
#include <bits/stdc++.h>

using namespace std;

constexpr int MAX_N = 100000;
constexpr int INF = (1 << 29);

int N, M, w[MAX_N], point;
bool visited[MAX_N], used[MAX_N];
vector<int> G[MAX_N];

bool dfs(int curr, int prev)
{
    if (visited[curr]) return 1;
    visited[curr] = 1;
    
    bool reach = 0;
    for (int next : G[curr]) {
        if (next == prev) continue;                
        reach |= dfs(next, curr);
    }

    if (reach) {
        used[curr] = 1;
        point += w[curr];
    }
    return reach;
}

int main()
{
    scanf("%d %d", &N, &M);
    for (int i = 0; i < N; i++) {
        scanf("%d", &w[i]);
    }

    for (int i = 0; i < M; i++) {
        int u, v;
        scanf("%d %d", &u, &v);
        u--; v--;
        G[u].emplace_back(v);
        G[v].emplace_back(u);
    }
    
    dfs(0, -1);
    
    using pii = pair<int, int>;
    priority_queue<pii> pq;
    pq.push(pii(0, 0));
    
    vector<int> d(N, -1);
    d[0] = 0;
    
    while (!pq.empty()) {
        pii p = pq.top(); pq.pop();
        int cost, curr;
        tie(cost, curr) = p;

        if (cost < d[curr]) continue;
        for (int next : G[curr]) {
            if (d[next] != -1) continue;
            
            d[next] = cost + (used[next] ? 0 : w[next]);
            pq.push(pii(d[next], next));
        }
    }
    
    point += *max_element(d.begin(), d.end());
    printf("%d\n", point + (!used[0] ? w[0] : 0));
    return 0;
}