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 range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;

template<typename T>
ostream& operator << (ostream& os, vector<T>& v){
	rep(i,v.size()){ os << v[i] << (i == v.size() - 1 ? "" : " "); } return os;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& v){
	for(T& x: v){ is >> x; } return is;
}

void dfs(vector<vector<int>>& g, vector<int>& in, vector<bool>& used, int pos, vector<bool>& p){
	used[pos] = true;
	for(auto to : g[pos]){
		if(used[to]) continue;
		dfs(g, in, used, to, p);
	}
	if(in[pos] == 1 and pos != 0){
		for(auto i : g[pos]){
			in[i]--;
		}
		p[pos] = true;
	}
}

int bfs(vector<vector<int>>& g, vector<bool>& used, vector<int>& w){
	int n = g.size();

	queue<int> q;
	rep(i,n){
		if(not used[i]) q.emplace(i);
	}

	vector<int> dis(n,0);
	while(not q.empty()){
		int pos = q.front(); q.pop();
		for(auto to : g[pos]){
			if(not used[to]) continue;
			used[to] = false;
			dis[to] = dis[pos] + w[to];
			q.emplace(to);
		}
	}

	return *max_element(all(dis));
}

int main(){
	int n, m;
	cin >> n >> m;

	vector<int> w(n);
	cin >> w;

	vector<vector<int>> g(n);
	rep(i,m){
		int a, b;
		cin >> a >> b;
		a--; b--;
		g[a].emplace_back(b);
		g[b].emplace_back(a);
	}

	vector<int> in(n);
	rep(i,n) in[i] = g[i].size();

	vector<bool> p(n,0);
	vector<bool> used(n,0);
	dfs(g, in, used, 0, p);

	int res = 0;
	rep(i,n){
		if(not p[i]) res += w[i];
	}

	cout << bfs(g, p, w) + res << endl;
}