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>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)n;++i)

using namespace std;

typedef pair<int,int>P;

const int MAX_N = 100005;

set<int> G[MAX_N];
set<int> nG[MAX_N];
bool flag[MAX_N];
int w[MAX_N];
int n,m,opt;

void dfs(int s,int cost)
{
    if(nG[s].size() == 0){
        if(opt < cost){
            opt = cost;
        }
        return;
    }
    for(auto it = nG[s].begin(); it != nG[s].end() ;it++){
        dfs(*it,cost+w[(*it)]);
    }
    return;
}

int main()
{
	scanf("%d%d",&n,&m);
	rep(i,n){
		scanf("%d",&w[i]);
	}
    rep(i,m){
        int x,y;
        scanf("%d%d",&x,&y);
        G[x-1].insert(y-1);
        G[y-1].insert(x-1);
    }
    rep(i,n){
        flag[i] = false;
    }
    queue<P> que;
    for(int i=1;i<n;i++){
        if(G[i].size() == 1){
            flag[i] = true;
            if(*G[i].begin() == 0){
                nG[0].insert(i);
                continue;
            }
            G[*G[i].begin()].erase(i);
            if(G[*G[i].begin()].size() == 1){
                que.push(P(*G[i].begin(),i));
                flag[*G[i].begin()] = true;
                nG[*G[i].begin()].insert(i);
            }else{
                nG[*G[i].begin()].insert(i);
            }
        }
    }
    while(!que.empty()){
        P p = que.front();
        int u = p.first;
        que.pop();
        if(*G[u].begin() == 0){
            nG[0].insert(u);
            continue;
        }
        G[*G[u].begin()].erase(u);
        if(G[*G[u].begin()].size() == 1){
            que.push(P(*G[u].begin(),u));
            flag[*G[u].begin()] = true;
            nG[*G[u].begin()].insert(u);
        }else{
            nG[*G[u].begin()].insert(u);
        }
    }
    for(int i=1;i<n;i++){
        if(!flag[i]){
            if(nG[i].size() > 0){
                for(auto it = nG[i].begin(); it != nG[i].end() ;it++){
                    nG[0].insert(*it);
                }
                nG[i].clear();
            }
        }
    }
    int res = 0;
    for(int i = 1;i < n;i++){
        if(!flag[i]){
            res += w[i];
        }
    }
    dfs(0,w[0]);
    res += opt;
    printf("%d\n",res);
	return 0;
}