#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589


#define izryt bool

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}
pii Dir[8] = { //?§????
	{ 0 ,1 },{ -1 ,0 },{ 1 ,0 },{ 0 ,-1 },
	{ 1 ,1 },{ 1 ,-1 },{ -1 ,1 },{ -1 ,-1 }
};
class Graph {
public:
	int vn;
	int sumcost = 0;
	vector<vector<pii>> g;

	Graph(int n) {
		vn = n;
		g.resize(n);
	}
	virtual void con(int a, int b, int w) = 0;
	int getWeight(int f, int t) {
		auto itr = lower_bound(ALL(g[f]), make_pair(t, INT_MIN));
		if (itr != g[f].end())
			return itr->second;
		return INT_MIN;
	}
	int Costsum() {
		return sumcost;
	}
};

class BiDGraph : public Graph {//??????
public:
	BiDGraph(int n) : Graph(n) {}

	void con(int a, int b, int w = 1) {
		g[a].push_back({ b,w });
		g[b].push_back({ a, w });
		sumcost++;
	}
};
class Heavy_Light_Decomposition {
public:
	BiDGraph g, compg;
	vector<int> sz, depth, chain, par;

	int bn = 0;
	vector<int> bvn, inbn;
	vector<vector<int>> bv;

	Heavy_Light_Decomposition(BiDGraph graph, int root) :
		g(graph), compg(graph.vn), sz(graph.vn, 1), depth(graph.vn), chain(graph.vn), par(graph.vn),
		bvn(graph.vn), inbn(graph.vn) {
		getsz(root, root);
		bv.push_back(vector<int>());
		HLD(root, -1, root, 0);
	}

	int getsz(int cur, int p) {
		par[cur] = p;
		for (auto itr : g.g[cur])
			if (p != itr.first)
				depth[itr.first] = depth[cur] + 1, sz[cur] += getsz(itr.first, cur);
		return sz[cur];
	}

	void HLD(int cur, int p, int head, int num) {
		chain[cur] = head, bvn[cur] = num;
		inbn[cur] = bv[num].size(), bv[num].push_back(cur);
		pii Maxc = { -1,-1 };
		for (auto itr : g.g[cur])
			if (itr.first != p)
				Maxc = max(Maxc, { sz[itr.first], itr.first });


		for (auto itr : g.g[cur])
			if (itr.first != p) {
				int nb = num;
				if (itr.first != Maxc.second) {
					bv.push_back(vector<int>());
					nb = ++bn;
				}
				HLD(itr.first, cur, itr.first == Maxc.second ? head : itr.first, nb);
			}
	}


	int lca(int a, int b) {
		if (chain[a] == chain[b]) return depth[a] < depth[b] ? a : b;
		if (depth[chain[a]] > depth[chain[b]])
			return lca(par[chain[a]], b);
		return lca(a, par[chain[b]]);
	}

	void for_each_edge(int a, int b, function<void(int, int)> func) {
		if (chain[a] == chain[b]) return func(inbn[a] < inbn[b] ? a : b, inbn[a] < inbn[b] ? b : a);
		if (depth[chain[a]] < depth[chain[b]]) swap(a, b);
		for_each_edge(a, chain[a], func), for_each_edge(par[chain[a]], b, func);
	}
	void for_each_edge_b(int a, int b, function<void(int, int)> func) {
		if (chain[a] == chain[b]) return func(a, b);
		for_each_edge_b(chain[b], b, func), for_each_edge_b(a,par[chain[b]], func);
	}
};
struct T {
	int sum, left, Max, right;
};
class Lazy_Segment_Tree {//0-indexed ??????
public:
	vector<T> data;
	vector<int> isl, lazy;
	int n;
	Lazy_Segment_Tree(int a) :n(1) {
		while (n < a) n *= 2;
		data.resize(n * 2 - 1);
		lazy.resize(n * 2 - 1);
		isl.resize(n * 2 - 1);
	}

	void denpa(int num, int base) {
		int l = (num + 1 - base) * (n / base), r = l + n / base;
		if (isl[num]) {
			if (lazy[num] > 0)
				data[num] = { lazy[num] * (r - l), lazy[num] * (r - l) , lazy[num] * (r - l) , lazy[num] * (r - l) };
			else
				data[num] = { lazy[num] * (r - l), lazy[num], lazy[num], lazy[num] };

			if (num < n - 1)
				isl[num * 2 + 1] = 1, isl[num * 2 + 2] = 1, lazy[num * 2 + 1] = lazy[num], lazy[num * 2 + 2] = lazy[num];
			lazy[num] = 0;
			isl[num] = 0;
		}
	}

	void upd(int a, int b, int ne, int num = 0, int base = 1) {
		int l = (num + 1 - base) * (n / base), r = l + n / base;

		denpa(num, base);
		if (a == l && b == r) {
			lazy[num] = ne;
			isl[num] = 1;
			denpa(num, base);
		}
		
		else {
			T m;
			int nr = (l + r) / 2;
			denpa(num*2+1, base*2);
			denpa(num * 2 + 2, base * 2);
			if (nr > a) upd(a, min(b, nr), ne, num * 2 + 1, base * 2);
			if (nr < b) upd(max(a, nr), b, ne, num * 2 + 2, base * 2);

			T l = data[num * 2 + 1], r = data[num * 2 + 2];
			data[num].sum = l.sum + r.sum;
			data[num].left = max(l.left,l.sum + r.left);
			data[num].Max = max({ l.Max, r.Max, l.right + r.left });
			data[num].right = max(r.right, r.sum + l.right);
		}
	}

	T Maxc(int a, int b, int num = 0, int base = 1) {
		int l = (num + 1 - base) * (n / base), r = l + n / base;
		denpa(num,base);
		if (a == l && b == r)
			return data[num];
		else {
			int nr = (l + r) / 2;
			T ret = T();
			T l = {}, r = {};
			bool lv = 0, rv = 0;
			if (nr > a) lv = 1,l = Maxc(a, min(b, nr), num * 2 + 1, base * 2);
			if (nr < b) rv = 1, r = Maxc(max(a, nr), b, num * 2 + 2, base * 2);
			ret.sum = l.sum + r.sum;
			ret.left = lv ? max(l.left, l.sum + r.left) : r.left;
			ret.Max = rv&&lv ? max({ l.Max, r.Max, l.right + r.left }) : lv ? l.Max : r.Max;
			ret.right = rv ? max(r.right, r.sum + l.right) : l.right;
			return ret;
		}
	}
};
signed main() {
	int n, q;
	scanf("%d %d", &n, &q);
	BiDGraph g(n);
	vector<int> w(n);
	REP(i, n) {
		scanf("%d", &w[i]);
	}
	REP(i, n - 1) {
		int a, b;
		scanf("%d %d", &a, &b);
		g.con(--a, --b);
	}

	Heavy_Light_Decomposition hld(g, 0);

	vector<Lazy_Segment_Tree> seg;

	REP(i, hld.bv.size()) {
		seg.push_back(Lazy_Segment_Tree(hld.bv[i].size()));
		REP(j, hld.bv[i].size()) {
			seg[i].upd(hld.inbn[hld.bv[i][j]], hld.inbn[hld.bv[i][j]]+1, w[hld.bv[i][j]]);
		}
	}

	REP(i, q) {
		int mode, a, b, c;
		scanf("%d %d %d %d", &mode, &a, &b, &c);
		if (mode == 1) {
			hld.for_each_edge(--a, --b, [&](int u, int v) {
				seg[hld.bvn[u]].upd(hld.inbn[u], hld.inbn[v] + 1, c);
			});
		}
		else {
			int lca = hld.lca(--a, --b);
			T ret[2] = {};
			bool us = 0;
			int alhab = 0;
			auto merge = [&](T a, T b) {
				T buf;
				buf.sum = a.sum + b.sum;
				buf.left = max(a.left, a.sum + b.left);
				buf.Max = max({ a.Max, b.Max, a.right + b.left });
				buf.right = max(b.right, b.sum + a.right);
				return buf;
			};
			hld.for_each_edge_b(lca,a, [&](int u, int v) {
				T ne = seg[hld.bvn[u]].Maxc(hld.inbn[u], hld.inbn[v] + 1, c);
				if (us) {
					ret[0] = merge(ne, ret[0]);
				}
				else us = 1,ret[0] = ne;
			});
			us = 0;
			hld.for_each_edge_b(lca,b,[&](int u, int v) {
				int buinb = hld.inbn[u];
				if (u == lca) buinb++;
				if (buinb > hld.inbn[v])
					return;
				T ne = seg[hld.bvn[u]].Maxc(buinb, hld.inbn[v] + 1, c);
				if (us) {
					ret[1] = merge(ne,ret[1]);
				}

				else us = 1, ret[1] = ne;
			});
			printf("%d\n",us ? max({ ret[0].Max, ret[1].Max, ret[1].left + ret[0].left }) : ret[0].Max);
		}
	}

	return 0;
}

Measured memory_bytes: 83168