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_V 100005
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;
int V;
vector<int> G[MAX_V];
vector<int> rG[MAX_V];
vector<int> vs;
bool used[MAX_V];
int cmp[MAX_V];

void add_edge(int from,int to){
  G[from].push_back(to);
  rG[to].push_back(from);
}

void dfs(int v){
  used[v]=true;
  for(int i=0;i<G[v].size();i++)
    if(!used[G[v][i]])dfs(G[v][i]);
  vs.push_back(v);
}

void rdfs(int v,int k){
  used[v]=true;
  cmp[v]=k;
  for(int i=0;i<rG[v].size();i++)
    if(!used[rG[v][i]])rdfs(rG[v][i],k);
}

int scc(){
  memset(used,0,sizeof(used));
  vs.clear();
  for(int v=0;v<V;v++)
    if(!used[v])dfs(v);
  memset(used,0,sizeof(used));
  int k=0;
  for(int i=vs.size()-1;i>=0;i--)
    if(!used[vs[i]])rdfs(vs[i],k++);
  return k;
}

vector<int> G2[MAX_V];
vector<P> G3[MAX_V];
int usede[MAX_V];

void dfs2(int x){
  for(int i=0;i<G3[x].size();i++){
    if(usede[G3[x][i].second])continue;
    usede[G3[x][i].second]=true;
    add_edge(x,G3[x][i].first);
    dfs2(G3[x][i].first);
  }
}

int n,m,w[MAX_V],u,v;
int sum[MAX_V],f[MAX_V];
int used2[MAX_V],ans;

int dfs3(int x){
  if(used[x])return 0;
  used[x]=true;
  int r=0;
  for(int i=0;i<G2[x].size();i++)
    r|=dfs3(G2[x][i]);
  if(f[cmp[x]])r=1;
  if(!used2[cmp[x]]&&r){
    ans+=sum[cmp[x]];
    used2[cmp[x]]=1;
  }
  return r;
}

int maxs=0;
void dfs4(int x,int s){
  int flag=0;
  for(int i=0;i<G2[x].size();i++){
    if(used[G2[x][i]])continue;
    used[G2[x][i]]=true;
    flag=1;
    if(cmp[x]!=cmp[G2[x][i]]&&!used2[cmp[x]])
      dfs4(G2[x][i],s+sum[cmp[x]]);
    else dfs4(G2[x][i],s);
  }
  if(!flag&&!used2[cmp[x]])maxs=max(maxs,s+sum[cmp[x]]);
}

void solve(){
  dfs2(0);
  int K=scc();
  for(int i=0;i<V;i++){
    if(sum[cmp[i]])f[cmp[i]]=1;
    sum[cmp[i]]+=w[i];
  }
  memset(used,0,sizeof(used));
  dfs3(0);
  memset(used,0,sizeof(used));
  used[0]=true;
  dfs4(0,0);
  ans+=maxs;
  cout<<ans<<endl;
}

int main(){
  cin>>n>>m;
  V=n;
  for(int i=0;i<n;i++)cin>>w[i];
  for(int i=0;i<m;i++){
    cin>>u>>v;
    u--,v--;
    G2[u].push_back(v);
    G2[v].push_back(u);
    G3[u].push_back(P(v,i));
    G3[v].push_back(P(u,i));
  }
  solve();
  return 0;
}