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<iostream>
#include<vector>
#include<utility>
#include<set>

#define rep(i,n) for(int i=0;i<(n);i++)
#define MP make_pair
#define PB push_back
using namespace std;

int n,m;

void bfs(int k,vector<int> &cnt,vector<bool>&b,vector<vector<int> > &g){
    if(cnt[k]==1||cnt[k]==0){
        b[k] = 0;
        for(int i:g[k]){
            if(b[i]){
                cnt[i]--;
                bfs(i,cnt,b,g);
            }
        }
    }   
}
bool bfs3(int k,int z,vector<bool>&b,vector<vector<int> > &g){
    if(b[k])return true;
    for(int x:g[k]){
        if(x!=z){
            if(bfs3(x,k,b,g))return b[k]=true;
        }
    } 
    return false;
}
int bfs2(int k,int z,vector<int>&w,vector<vector<int> > &g){
    int s=w[k];
    int mx = 0;
    for(int x:g[k]){
        if(x!=z){
            mx = max(mx,bfs2(x,k,w,g));
        }
    }
    return s+mx;
}


int main(){
    cin >> n >> m;
    vector<int> w(n+1);
    vector<vector<int> > g(n);
    rep(i,n)cin >> w[i];
    rep(i,m){
        int u,v;
        cin >> u >> v;
        u--;v--;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    vector<int> cnt(n);
    rep(i,n){
        cnt[i] = g[i].size();
    }
    vector<bool> b(n,1);
    rep(i,n){
        bfs(i,cnt,b,g);
    }
    if(!b[0]){
        bfs3(0,0,b,g);
    }
    vector<int>p;
    int sm=0;
    rep(i,n){
        if(b[i]){
            p.PB(i);
            sm+=w[i];
        }
    }
    w[n]=sm;
    set<int>st;
    for(int x:p){
        for(int y:g[x]){
            st.insert(y);
        }
    }
    vector<vector<int> >g2(n+1);
    rep(i,n){
        if(!b[i]){
            for(int x:g[i]){
                if(b[x]){
                    g2[i].PB(n);
                    g2[n].PB(i);
                }else{
                    g2[i].PB(x);
                }
            }
        }
    }
    if(b[0]){
        cout << bfs2(n,n,w,g2) << endl;
    }else{
        cout << bfs2(0,0,w,g2) << endl;
    }
    return 0;
}