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 MAX_N 100011
#define N MAX_N
#define rank dfasfds
using namespace std;
typedef long long ll;
typedef vector<int> S;
int par[MAX_N],rank[MAX_N];
ll val[MAX_N];
S G[N];

void init(int n){for(int i=0;i<N;i++)par[i]=i,rank[i]=0;}

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

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

void unite(int x,int y){
  x=find(x),y=find(y);
  if(x==y)return;
  if(rank[x]<rank[y])par[x]=y,val[y]+=val[x];
  else{
    par[y]=x;
    val[x]+=val[y];
    if(rank[x]==rank[y])rank[x]++;
  }
}

int used[N];
vector<int> path;
void dfs(int pos,int pre){
  if(used[pos]||pos!=find(pos)) {
    while(path.size())unite(0,path.back()),path.pop_back();
    return;
  }
  used[pos]=1;
  path.push_back(pos);

  for(S::iterator it=G[pos].begin();it!=G[pos].end();it++)if(*it!=pre)dfs(*it,pos);
  used[pos]=0;
  if(path.size()&&path.back()==pos) path.pop_back();
}

vector<int>col[N];
ll get_mx(int pos){
  pos=find(pos);
  used[pos]=1;
  ll res=0;
  
  for(int i=0;i<col[pos].size();i++)
    for(S::iterator it=G[col[pos][i]].begin();it!=G[col[pos][i]].end();it++)
      if(!used[find(*it)])res=max(res,get_mx(find(*it)));
  return res+val[find(pos)];
}

int main(){
  int n,m;
  cin>>n>>m;
  for(int i=0;i<n;i++) cin>>val[i];
  for(int i=0,a,b;i<m;i++){
    cin>>a>>b;a--,b--;
    G[a].push_back(b);
    G[b].push_back(a);

    //    G[a].insert(b);
    //  G[b].insert(a);
  }
  init(n);
  dfs(0,-1);
  for(int i=0;i<n;i++) col[find(i)].push_back(i);
  cout <<get_mx(find(0))<<endl;

  return 0;
}