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;
using ll = long long;
using ld = long double;
using u32 = uint32_t;
using vi = vector<int>;    using vvi = vector<vi>;
using vb = vector<bool>;   using vvb = vector<vb>;
using vl = vector<ll>;     using vvl = vector<vl>;
using vd = vector<double>; using vvd = vector<vd>;

#define MAXC(c, x) (c = max(c, x))

#define REP(i,n) for(auto i = 0 * (n), i##_len = (n); i < i##_len; ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOR(i,s,n) for(ll i=s, i##_len=(ll)(n); i<i##_len; ++i)
#define TEN(x) ((ll)1e##x)
const ll mod = TEN(9) + 7;

// ??£??\???????????¨
struct Edge { uint32_t to, id; };
using Graph = vector<vector<Edge>>;

struct Bridge {
#define PB push_back
	typedef uint32_t T;
	typedef vector<T> vt;
	explicit Bridge(const Graph & g) : v2cmp(g.size()) {
		T n = g.size(), k = 0;
		vt ord(n, 0), low(n), stk;
		function<void(T, T, T)> f = [&](T c, T p, T id) {
			ord[c] = low[c] = ++k;
			stk.PB(c);
			for (auto e : g[c]) {
				if (!ord[e.to]) {
					f(e.to, c, e.id);
					low[c] = min(low[c], low[e.to]);
				} else if (e.id != id) {
					low[c] = min(low[c], ord[e.to]);
				}
			}
			if (low[c] == ord[c]) {
				if (p != n) bridge.PB({ id, min(c, p), max(c, p) });
				component.PB({});
				T v; do {
					v2cmp[v = stk.back()] = component.size() - 1;
					stk.pop_back();
					component.back().PB(v);
				} while (v != c);
			}
		};
		for (T i = 0; i < n; ++i) if (!ord[i]) f(i, n, T(-1));
	}
	// BridgeEdge : u < v ?????????????????????
	// v2cmp[v]   : ?????? v ????±?????????????????????????????????????????????????
	struct BridgeEdge { T id, u, v; };
	vt v2cmp;
	vector<BridgeEdge> bridge;
	vector<vt> component;
};

int main() {
#ifdef INPUT_FROM_FILE
	ifstream cin("sample.in");
	ofstream cout("sample.out");
#endif
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(50);
	u32 n, m; cin >> n >> m;
	vl w(n); REP(i, n) cin >> w[i];
	Graph g(n);
	REP(i, m) {
		u32 u, v;
		cin >> u >> v;
		u--; v--;
		g[u].push_back({ v, i });
		g[v].push_back({ u, i });
	}

	Bridge dcc(g);
	auto&& cmp = dcc.component;

	vl w_cmp(cmp.size(), 0);
	REP(i, cmp.size()) {
		for (auto&& id : cmp[i]) w_cmp[i] += w[id];
	}

	vb visited(cmp.size(), false);
	function<array<ll, 2>(u32)> dfs = [&](u32 cur_cmp) {
		array<ll, 2> ma = {0, 0};
		visited[cur_cmp] = true;
		for (auto&& v : cmp[cur_cmp]) for (auto&& next : g[v]) {
			u32 next_cmp = dcc.v2cmp[next.to];
			if (visited[next_cmp]) continue;
			auto ret = dfs(next_cmp);
			ma[1] = max(ma[1], ret[1]);
			ma[0] += ret[0];
		}
		if (ma[0] || cmp[cur_cmp].size() > 1) ma[0] += w_cmp[cur_cmp];
		if (!ma[0]) ma[1] += w_cmp[cur_cmp];
		return ma;
	};

	auto p = dfs(dcc.v2cmp[0]);
	cout << p[0] + p[1] << endl;

	return 0;
}