Given a tree with n (1 ≤ n ≤ 200,000) nodes and a list of q (1 ≤ q ≤ 100,000) queries, process the queries in order and output a value for each output query. The given tree is connected and each node on the tree has a weight wi (-10,000 ≤ wi ≤ 10,000).

Each query consists of a number ti (ti = 1, 2), which indicates the type of the query , and three numbers ai, bi and ci (1 ≤ ai, bi ≤ n, -10,000 ≤ ci ≤ 10,000). Depending on the query type, process one of the followings:

* (ti = 1: modification query) Change the weights of all nodes on the shortest path between ai and bi (both inclusive) to ci.

* (ti = 2: output query) First, create a list of weights on the shortest path between ai and bi (both inclusive) in order. After that, output the maximum sum of a non-empty continuous subsequence of the weights on the list. ci is ignored for output queries.



Input

The first line contains two integers n and q. On the second line, there are n integers which indicate w1, w2, ... , wn.

Each of the following n - 1 lines consists of two integers si and ei (1 ≤ si, ei ≤ n), which means that there is an edge between si and ei.

Finally the following q lines give the list of queries, each of which contains four integers in the format described above. Queries must be processed one by one from top to bottom.

Output

For each output query, output the maximum sum in one line.

Examples

Input

3 4
1 2 3
1 2
2 3
2 1 3 0
1 2 2 -4
2 1 3 0
2 2 2 0


Output

6
3
-4


Input

7 5
-8 5 5 5 5 5 5
1 2
2 3
1 4
4 5
1 6
6 7
2 3 7 0
2 5 2 0
2 4 3 0
1 1 1 -1
2 3 7 0


Output

12
10
10
19


Input

21 30
10 0 -10 -8 5 -5 -4 -3 1 -2 8 -1 -7 2 7 6 -9 -6 3 4 9
10 3
3 2
3 12
12 4
4 13
4 9
10 21
21 1
1 11
11 14
1 15
10 6
6 17
6 16
6 5
5 18
5 19
10 7
10 8
8 20
1 1 21 -10
1 3 19 10
2 1 13 0
1 4 18 8
1 5 17 -5
2 16 7 0
1 6 16 5
1 7 15 4
2 4 20 0
1 8 14 3
1 9 13 -1
2 9 18 0
1 10 12 2
1 11 11 -8
2 21 15 0
1 12 10 1
1 13 9 7
2 6 14 0
1 14 8 -2
1 15 7 -7
2 10 2 0
1 16 6 -6
1 17 5 9
2 12 17 0
1 18 4 6
1 19 3 -3
2 11 8 0
1 20 2 -4
1 21 1 -9
2 5 19 0


Output

20
9
29
27
10
12
1
18
-2
-3
#include <bits/stdc++.h>
#define N 200010
using namespace std;

int n, q, data[N];
vector<int> edge[N];

int dfn[N], top[N], f[N], size[N], son[N], d[N];
int _index;
void dfs(int u, int fa) {
	f[u] = fa;
	d[u] = d[fa] + 1;
	size[u] = 1;
	for (int i = 0; i < edge[u].size(); ++i) {
		int v = edge[u][i];
		if (v == fa) continue;
		dfs(v, u);
		size[u] += size[v];
		if (size[v] > size[son[u]]) son[u] = v;
	}
}

int val[N];
void build(int u, int tp) {
	top[u] = tp;
	dfn[u] = ++_index;
	val[_index] = data[u];
	if (son[u]) build(son[u], tp);
	for (int i = 0; i < edge[u].size(); ++i) {
		int v = edge[u][i];
		if (v != f[u] && v != son[u]) build(v, v);
	}
}

#define ls (x << 1)
#define rs (x << 1 | 1)

struct info {
	int max_l, max_r, max_mid, sum;
	info() {}
	info(int x) {
		max_l = max_r = max_mid = sum = x;
	}
	friend info operator + (const info &a, const info &b) {
		info res;
		res.sum = a.sum + b.sum;
		res.max_l = max(a.max_l, a.sum + max(0, b.max_l));
		res.max_r = max(b.max_r, b.sum + max(0, a.max_r));
		res.max_mid = max(max(a.max_mid, b.max_mid), max(max(a.max_r, 0) + b.max_l, a.max_r + max(b.max_l, 0)));
		return res;
	}
	inline info reverse() const {
		info res = *this;
		swap(res.max_l, res.max_r);
		return res;
	}
	void update(int val, int size) {
		sum = val * size;
		if (val > 0) max_l = max_r = max_mid = sum;
		else max_l = max_r = max_mid = val;
	}
};

struct node {
	info val;
	int lab;
	bool vis;
}tr[N << 2];

void buildTree(int x, int l, int r) {
	if (l == r) {
		tr[x].val = info(val[l]);
		tr[x].vis = 0;
		return;
	}
	int mid = l + r >> 1;
	buildTree(ls, l, mid);
	buildTree(rs, mid + 1, r);
	tr[x].val = tr[ls].val + tr[rs].val;
}

void push_down(int x, int l, int r) {
	if (!tr[x].vis) return;
	int mid = l + r >> 1;
	tr[ls].val.update(tr[x].lab, mid - l + 1);
	tr[ls].vis = 1;
	tr[ls].lab = tr[x].lab;
	tr[rs].val.update(tr[x].lab, r - mid);
	tr[rs].vis = 1;
	tr[rs].lab = tr[x].lab;
	tr[x].vis = 0;
}

void modify(int x, int l, int r, int a, int b, int val) {
	if (a <= l && r <= b) {
		tr[x].vis = 1;
		tr[x].lab = val;
		tr[x].val.update(val, r - l + 1);
		return;
	}
	push_down(x, l, r);
	int mid = l + r >> 1;
	if (a <= mid) modify(ls, l, mid, a, b, val);
	if (b > mid) modify(rs, mid + 1, r, a, b, val);
	tr[x].val = tr[ls].val + tr[rs].val;
//cout << l << ' ' << r << ' ' << tr[x].val.max_mid << ' ' << tr[x].val.max_l << ' ' << tr[x].val.max_r << endl;
}

info query(int x, int l, int r, int a, int b) {
	if (a <= l && r <= b) {
//cout << l << ' ' << r << ' ' << a << ' ' << b << ' ' << tr[x].val.max_mid << ' ' << endl;	
		return tr[x].val;
	}
	int mid = l + r >> 1;
	push_down(x, l, r);
	info res;
	if (b <= mid) {
		res = query(ls, l, mid, a, b);
	} else if (a > mid) {
		res = query(rs, mid + 1, r, a, b);
	} else {
		res = query(ls, l, mid, a, b) + query(rs, mid + 1, r, a, b);
	}
	tr[x].val = tr[ls].val + tr[rs].val;
	return res;
}

void modify(int x, int y, int c) {
	int fx = top[x], fy = top[y];
	while (fx != fy) {
		if (d[fx] < d[fy]) {
			swap(fx, fy);
			swap(x, y);
		}
		modify(1, 1, n, dfn[fx], dfn[x], c);
		x = f[fx];
		fx = top[x];
	}
	if (d[x] > d[y]) swap(x, y);
	modify(1, 1, n, dfn[x], dfn[y], c);
}

int query(int x, int y) {
	int fx = top[x], fy = top[y];
	info res_l, res_r;
	bool flag_l = 0, flag_r = 0;
	while (fx != fy) {
		if (d[fx] < d[fy]) {
			if (!flag_r) {
				flag_r = 1;
				res_r = query(1, 1, n, dfn[fy], dfn[y]);
			} else {
				res_r = query(1, 1, n, dfn[fy], dfn[y]) + res_r;
			}
			y = f[fy];
			fy = top[y];
		} else {
			if (!flag_l) {
				flag_l = 1;
				res_l = query(1, 1, n, dfn[fx], dfn[x]).reverse();
			} else {
				res_l = res_l + query(1, 1, n, dfn[fx], dfn[x]).reverse();
			}
			x = f[fx];
			fx = top[x];
		}
	}
	info res;
	if (d[x] < d[y]) {
		res = query(1, 1, n, dfn[x], dfn[y]);
	} else {
		res = query(1, 1, n, dfn[y], dfn[x]).reverse();
	}
	if (flag_l) res = res_l + res;
	if (flag_r) res = res + res_r;
	return res.max_mid;
}

int main() {
	// freopen("DD.in","r",stdin);
	scanf("%d%d", &n, &q);
	for (int i = 1; i <= n; ++i) {
		scanf("%d", &data[i]);
	}
	for (int i = 1; i < n; ++i) {
		int a, b;
		scanf("%d%d", &a, &b);
		edge[a].push_back(b);
		edge[b].push_back(a);
	}
	dfs(1, 0);
	build(1, 1);
	buildTree(1, 1, n);
	//for (int i = 1; i <= n; ++i) cout << top[i] << ' ' << f[i] << ' ' << son[i] << endl;
	for (int i = 1; i <= q; ++i) {
		int x, a, b, c;
		scanf("%d%d%d%d", &x, &a, &b, &c);
		if (x == 1) modify(a, b, c);
		else printf("%d\n", query(a, b));
	}
	return 0;
}