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;
 
#define int long long
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
 
 
struct UF{
    int N;
    vint par;
    void init(int n){
        N=n;
        par.resize(N);
        rep(i,N)par[i]=i;
    }
    int find(int x){
        return x==par[x]?x:par[x]=find(par[x]);
    }
    void unite(int x,int y){
        par[find(y)]=find(x);
    }
};
 
const int SIZE=100000;
int N,M;
int w[SIZE],sz[SIZE];
vint G[SIZE];
 
bool used[SIZE];
int ord[SIZE],low[SIZE];
vpint bridge;
 
void dfs(int v,int p,int &k){
    used[v]=true;
    ord[v]=k++;
    low[v]=ord[v];
 
    for(auto to:G[v]){
        if(!used[to]){
            dfs(to,v,k);
            low[v]=min(low[v],low[to]);
            if(ord[v]<low[to])bridge.pb(pint(min(v,to),max(v,to)));
        }
        else if(to!=p){
            low[v]=min(low[v],ord[to]);
        }
    }
}
    //return   no return
int dp[SIZE],dp2[SIZE];
void dfs2(int v,int p){
    for(auto to:G[v]){
        if(to==p)continue;
        dfs2(to,v);
        dp[v]+=dp[to];
    }
    int sum=dp[v];
    if(dp[v]||sz[v]>1)dp[v]+=w[v];
 
    for(auto to:G[v]){
        if(to==p)continue;
        chmax(dp2[v],sum-dp[to]+dp2[to]);
    }
    dp2[v]+=w[v];
}
 
signed main(){
    scanf("%lld%lld",&N,&M);
    rep(i,N)scanf("%lld",&w[i]);
    rep(i,M){
        int a,b;
        scanf("%lld%lld",&a,&b);
        a--;b--;
        G[a].pb(b);G[b].pb(a);
    }
    int K;
    dfs(0,-1,K);
 
    sort(all(bridge));
    UF uf;uf.init(N);
    rep(v,N)for(auto to:G[v])if(v<to){
        if(binary_search(all(bridge),pint(v,to)))continue;
        uf.unite(v,to);
    }
    vint ps;
    rep(i,N)if(uf.find(i)==i)ps.pb(i);
    rep(i,N)G[i].clear();
    for(auto &p:bridge){
        int u=lower_bound(all(ps),uf.find(p.fi))-ps.begin();
        int v=lower_bound(all(ps),uf.find(p.se))-ps.begin();
        G[u].pb(v);G[v].pb(u);
    }
    int ww[SIZE]={0};
    rep(i,N){
        int p=lower_bound(all(ps),uf.find(i))-ps.begin();
        ww[p]+=w[i];
        sz[p]++;
    }
    N=ps.size();
    rep(i,N)w[i]=ww[i];
 
    int s=lower_bound(all(ps),uf.find(0))-ps.begin();
    dfs2(s,-1);
    cout<<dp2[s]<<endl;
    return 0;
}