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;
vector<int> v[100001],a;
int u[100001];
  
int dfs(int x,int p) {
  if(u[x])return 1;
  u[x]=1;
  int f=0;
  for(int i=0;i<v[x].size();i++)if(p!=v[x][i])f|=dfs(v[x][i],x);
  if(f)a.push_back(x);
  return f;
}
  
int main() {
  int n,m;
  cin>>n>>m;
  int w[n];
  for(int i=0;i<n;i++)cin>>w[i];
  for(int i=0,x,y;i<m;i++){
    cin>>x>>y;
    x--,y--;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  dfs(0,-1);
  int d[n],ans=0,M=0;
  fill(d,d+n,-1);
  priority_queue<P,vector<P>,greater<P> >q;
  for(int i=0;i<a.size();i++){
    q.push(P(0,a[i]));
    d[a[i]]=0;
    ans+=w[a[i]];
  }
  if(q.empty())q.push(P(w[0],0)),d[0]=w[0];
  while(!q.empty()) {
    P p=q.top();q.pop();
    int x=p.second,c=p.first;
    if(d[x]>c)continue;
    for(int i=0;i<v[x].size();i++) {
      int y=v[x][i];
      if(d[y]==-1)d[y]=d[x]+w[y],q.push(P(d[y],y));
    }
  }
  for(int i=0;i<n;i++)M=max(M,d[i]);
  cout<<ans+M<<endl;
  return 0;
}