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;
typedef pair<int,int> P;
#define MAX 100005

int p[MAX];
int q[MAX];

int find(int x){
  if(p[x]==x)return x;
  return p[x]=find(p[x]);
}

void unite(int x,int y){
  x=find(x);y=find(y);
  if(x==y)return;
  p[x]=y;
  q[y]+=q[x];
}

bool same(int x,int y){
  return (find(x)==find(y));
}

int V,E;
vector<int> G[MAX];
vector<int> nG[MAX];
map<int,bool> used[MAX];

int s[MAX],t[MAX];
int depth[MAX];
int cnt[MAX];
int visited[MAX];
bool flg[MAX];


void dfs(int pos,int prev){
  visited[pos]=true;
  for(int i=0;i<(int)G[pos].size();i++){
    int to=G[pos][i];
    if(to==prev)continue;
    if(!visited[to]){
      depth[to]=depth[pos]+1;
      dfs(to,pos);
      cnt[pos]+=cnt[to];
      if(cnt[to])unite(pos,to);
    }else if(depth[to]<depth[pos]){
      unite(pos,to);
      cnt[pos]++;
      cnt[to]--;
    }else{
      unite(pos,to);
    }
  }
}

P solve(int pos,int prev=-1){
  int res=-1,res2=0,sum=t[pos];
  for(int i=0;i<(int)nG[pos].size();i++){
    int to=nG[pos][i];
    if(to==prev || to==pos)continue;
    P pw=solve(to,pos);
    res=max(res,pw.first);
    if(pw.first!=-1){
      sum+=pw.first;
      res2=max(res2, -pw.first+pw.second);
    }else{
      res2=max(res2,pw.second);
    }
  }
  if(q[pos]==1 && res==-1){
    return P(-1,sum+res2);
  }
  return P(sum,sum+res2);
}

int main(){
  scanf("%d %d",&V,&E);
  for(int i=0;i<V;i++){
    scanf("%d",&s[i]);
    p[i]=i;
    q[i]=1;
  }
  for(int i=0;i<E;i++){
    int a,b;
    scanf("%d %d",&a,&b);
    a--,b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  dfs(0,-1);
  for(int pos=0;pos<V;pos++){
    for(int i=0;i<(int)G[pos].size();i++){
      int to=find(G[pos][i]);
      if(used[pos].count(to)>0)continue;
      used[pos][to]=true;
      nG[ find(pos) ].push_back( to );
    }
    t[ find(pos) ]+=s[pos];
  }
  P ans=solve(find(0),-1);
  printf("%d\n", ans.second);
  return 0;
}