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<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<sstream>
#include<map>
#include<queue>
using namespace std;
#define int long long
vector<vector<int> >g;
vector<int> v;
void dfs(int a) {
	v[a] = 1;
	for (int i = 0; i < g[a].size(); i++) {
		if (v[g[a][i]] == 0) {
			dfs(g[a][i]);
		}
	}
}
signed main() {
	int N;
	int M;
	cin >> N >> M;
	g.resize(N);
	v.resize(N, 0);
	vector<int> W(N);
	for (int i = 0; i < N; i++) {
		cin >> W[i];
	}
	int a, b;
	for (int i = 0; i < M; i++) {
		cin >> a >> b;
		a--;
		b--;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	dfs(0);
	vector<int> deg(N);
	int INF = (int)1 << 60;
	vector<int> dp(N, 0);
	for (int i = 0; i < N; i++) {
		deg[i] = g[i].size();
	}
	queue<int> qu;
	for (int i = 1; i < N; i++) {
		if (v[i] == 1) {
			if (deg[i] == 1) {
				qu.push(i);
				dp[i] = 0;
			}
		}
	}
	while (!qu.empty()) {
		int a = qu.front(); qu.pop();
		for (int i = 0; i < g[a].size(); i++) {

			deg[g[a][i]]--;
			if (g[a][i] != 0) {
				if (deg[g[a][i]] == 1) {
					qu.push(g[a][i]);
				}
			}
			dp[g[a][i]] = max(dp[g[a][i]], dp[a] + W[a]);
		}
	}

	int mx = 0;
	int res = 0;
	res = W[0];
	mx = dp[0];
	for (int i = 1; i < N; i++) {
		if (v[i] == 1) {
			if (deg[i] >= 2) {
				res += W[i];
				mx = max(mx, dp[i]);
			}
		}
	}
	res += mx;
	cout << res << endl;
}