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 <map>
using namespace std;
#pragma warning (disable: 4996)

int N, M, A[1 << 17], P[1 << 17], Q[1 << 17], pre[1 << 17], low[1 << 17], col[1 << 17], R[1 << 17], dp[1 << 17], dp2[1 << 17], cnts, cntw;
vector<int>X[1 << 17], Y[1 << 17], Z[1 << 17], W[1 << 17];
map<pair<int, int>, int>Map;
bool used[1 << 17];

void dfs(int pos, int prevs) {
	cnts++; pre[pos] = cnts;
	low[pos] = cnts;

	for (int i = 0; i < X[pos].size(); i++) {
		int to = X[pos][i];
		if (pre[to] != 0) {
			if (prevs != to) low[pos] = min(low[pos], low[to]);
			continue;
		}

		dfs(to, pos); low[pos] = min(low[pos], low[to]);

		if (low[to] == pre[to]) {
			Map[make_pair(pos, to)] = 1;
			Map[make_pair(to, pos)] = 1;
		}
	}
}

void dfs2(int pos) {
	if (col[pos] >= 1) return;
	col[pos] = cntw; if (R[cntw] != 0) used[cntw] = true; R[cntw] += A[pos];
	for (int i = 0; i < Y[pos].size(); i++) {
		dfs2(Y[pos][i]);
	}
}

void dfs3(int pos) {
	dp[pos] = 0; int maxn = 0;
	for (int i = 0; i < Z[pos].size(); i++) {
		int to = Z[pos][i];
		if (dp[to] != -1) continue;
		dfs3(to); if (used[to] == true) used[pos] = true;
		W[pos].push_back(to);
		maxn = max(maxn, dp[to]);
	}
	dp[pos] = maxn;
	dp[pos] += R[pos];
}
void dfs4(int pos) {
	dp2[pos] = 0; int maxn = 0;
	for (int i = 0; i < Z[pos].size(); i++) {
		int to = Z[pos][i];
		if (dp2[to] != -1 || used[to] == false) continue;
		dfs4(to);
		maxn = max(maxn, dp2[to]);
	}
	dp2[pos] = maxn;
	dp2[pos] += R[pos];
}

int main() {
	//FILE *in = freopen("in1.txt", "r", stdin);
	cin >> N >> M;
	for (int i = 1; i <= N; i++) { cin >> A[i]; low[i] = (1 << 30); dp[i] = -1; dp2[i] = -1; }
	for (int i = 0; i < M; i++) {
		cin >> P[i] >> Q[i];
		X[P[i]].push_back(Q[i]);
		X[Q[i]].push_back(P[i]);
	}
	dfs(1, -1);

	for (int i = 0; i < M; i++) {
		if (Map[make_pair(P[i], Q[i])] == 0) {
			Y[P[i]].push_back(Q[i]);
			Y[Q[i]].push_back(P[i]);
		}
	}
	for (int i = 1; i <= N; i++) {
		if (col[i] >= 1) continue;
		cntw++;
		dfs2(i);
	}
	for (int i = 0; i < M; i++) {
		if (col[P[i]] != col[Q[i]]) {
			Z[col[P[i]]].push_back(col[Q[i]]);
			Z[col[Q[i]]].push_back(col[P[i]]);
		}
	}
	dfs3(col[1]);
	dfs4(col[1]);

	int ans = 0, maxn = 0; used[1] = true;
	for (int i = 1; i <= N; i++) { if (used[i] == true) ans += R[i]; }
	for (int i = 1; i <= N; i++) { if (used[i] == false) maxn = max(maxn, dp[i]); }
	ans += maxn;
	cout << ans << endl;
	return 0;
}