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;
#define all(x) (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n",(x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define isYes(x) printf("%s\n",(x) ? "Yes" : "No")
#define isIn(x,y,h,w) (x >= 0 && x < h && y >= 0 && y < w)

#define int long long
//using ll = long long;
using P = pair<int,int>;

ostream &operator<<(ostream &os,const P &p){ return os << "(" << p.first << "," << p.second << ")"; }
template<class T>
ostream &operator<<(ostream &os,const vector<T> &v){
	for(int i = 0;i < v.size();i++) os << (i ? "," : "[") << v[i];
	os << "]";
	return os;
}

template<class T> T &chmin(T &a,const T &b){ return a = min(a,b); }
template<class T> T &chmax(T &a,const T &b){ return a = max(a,b); }

const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

template<class T>
struct Edge{
	int from,to;
	T cost;
	Edge(int to,T cost) : to(to),cost(cost){}
	Edge(int from,int to,T cost) : from(from),to(to),cost(cost){}
	operator int() const noexcept { return to; }
};

template<class T>
using WeightedGraph = vector<vector<Edge<T>>>;
using Graph = vector<vector<int>>;
template<class T>
using Matrix = vector<vector<T>>;

template<class T>
struct TwoEdgeConnectedComponents{
	T G;
	Graph nG;
	vector<int> cmp,depth,s;
	vector<vector<int>> tecc;
	stack<int> vs;
	vector<pair<int,int>> bridge;

	int operator[](int i) const{ return cmp[i]; }

	TwoEdgeConnectedComponents(const T &G) : G(G),cmp(G.size()),depth(G.size(),-1),s(G.size()){}

	void dfs(int v,int par,int d){
		depth[v] = d;
		vs.push(v);
		for(const auto &e : G[v]){
			int to = (int)e;
			if(depth[to] == -1){
				dfs(to,v,d + 1);
				s[v] += s[to];
			}else if(to != par && depth[v] > depth[to]) s[to]--,s[v]++;
		}
		if(!s[v]){
			if(par != -1) bridge.push_back(minmax(v,par));
			tecc.emplace_back();
			while(1){
				int u = vs.top(); vs.pop();
				tecc.back().push_back(u);
				cmp[u] = tecc.size() - 1;
				if(u == v) break;
			}
		}
	}

	void build(){
		for(int i = 0;i < G.size();i++) if(depth[i] == -1) dfs(i,-1,0);
		nG.resize(tecc.size());
		for(const auto &e : bridge){
			int x = cmp[e.first],y = cmp[e.second];
			nG[x].push_back(y);
			nG[y].push_back(x);
		}
	}
};

int n,m,w[100010],s[100010],ma = 0;
bool isMulti[100010];

bool dfs(TwoEdgeConnectedComponents<Graph> &tecc,int v,int par){
	isMulti[v] = (tecc.tecc[v].size() >= 2);
	for(int to : tecc.nG[v]){
		if(to != par){
			isMulti[v] |= dfs(tecc,to,v);
			chmax(s[v],s[to]);
		}
	}
	s[v] += w[tecc.tecc[v][0]];
	if(!isMulti[v]) chmax(ma,s[v]);
	return isMulti[v];
}

signed main(){
	cin >> n >> m;
	for(int i = 0;i < n;i++) cin >> w[i];
	Graph G(n);
	for(int i = 0;i < m;i++){
		int u,v;
		cin >> u >> v; u--;v--;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	TwoEdgeConnectedComponents<Graph> tecc(G);
	tecc.build();
	dfs(tecc,tecc[0],-1);
	int ans = 0;
	for(int i = 0;i < tecc.tecc.size();i++){
		if(isMulti[i]){
			for(int v : tecc.tecc[i]) ans += w[v];
		}
	}
	cout << ans + ma << endl;
}