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<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;
typedef long long  ll;
typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef double ld;
typedef complex<ld> Point;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
typedef vector<int> vec;

const int mn = 100000;
vector<int> G[100000];
int w[100000];

int c[100000];
bool non[100000];

int sum, ma;
bool exi0 = false;
int dfs(int id, int fr) {
	if (id == 0)exi0 = true;
	int ret = 0;
	rep(j, G[id].size()) {
		int to = G[id][j];
		if (fr == to)continue;
		if (!non[to]) {
			ret = max(ret, sum + ma);
		}
		else {
			ret = max(ret, dfs(to, id));
		}
	}
	return ret + w[id];
}
int csum;
bool dfs2(int id, int fr) {
	rep(j, G[id].size()) {
		int to = G[id][j];
		if (fr == to)continue;
		if (!non[to]) {
			csum += w[id];
			w[id] = 0;
			return true;
		}
		if (dfs2(to, id)) {
			csum += w[id];
			w[id] = 0;
			return true;
		}
	}
	return false;
}

void solve() {
	int n, m; cin >> n >> m;
	rep(i, n)cin >> w[i];
	rep(i, m) {
		int a, b; cin >> a >> b; a--; b--;
		G[a].push_back(b);
		G[b].push_back(a);
		c[a]++; c[b]++;
	}
	queue<int> q;
	rep(i, n) {
		if (c[i] == 1) {
			q.push(i);
			non[i] = true;
		}
	}
	while (!q.empty()) {
		int id = q.front(); q.pop();
		rep(j, G[id].size()) {
			int to = G[id][j];
			c[to]--;
			if (c[to] == 1) {
				q.push(to);
				non[to] = true;
			}
		}
	}
	rep(i, n) {
		if (!non[i])sum += w[i];
	}
	rep(i, n)if (!non[i]) {
		rep(j, G[i].size()) {
			int to = G[i][j];
			if (!non[to])continue;
			exi0 = false;
			int z = dfs(to, i);
			if (!exi0) {
				ma = max(ma, z);
			}
		}
	}
	if (!non[0]) {
		cout << sum + ma << endl;
	}
	else {
		int ans = dfs(0, -1);
		dfs2(0,-1);
		rep(i, n)if (!non[i]) {
			rep(j, G[i].size()) {
				int to = G[i][j];
				if (!non[to])continue;
				ma = max(ma, dfs(to, i));
			}
		}
		ans = max(ans, csum + sum + ma);
		cout << ans << endl;
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(5);
	//while (cin >> n,n)solve();
	solve();
	//stop
	return 0;
}