#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <ctime>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <deque>
#include <complex>
#include <string>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <valarray>
#include <unordered_map>
#include <iterator>
#include <functional>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();i++)
#define ALL(container) (container).begin(), (container).end()
#define RALL(container) (container).rbegin(), (container).rend()
#define SZ(container) ((int)container.size())
#define mp(a,b) make_pair(a, b)
#define pb push_back
#define eb emplace_back
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
template<class T> ostream& operator<<(ostream &os, const set<T> &t) {
os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class S, class T> pair<S,T> operator+(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first+t.first, s.second+t.second);}
template<class S, class T> pair<S,T> operator-(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first-t.first, s.second-t.second);}

const int INF = 2000000000;
const double EPS = 1e-8;
const int MOD = 1000000007;

struct handler{
	typedef struct vt{
		int l, r, sum, ans;
		vt(int l, int r, int sum, int ans)
			:l(l), r(r), sum(sum), ans(ans){}
		vt(int x=0){
			l=r=sum=ans=x;
		}
		friend ostream &operator<<(ostream &os, const vt &t){
			return os << "{" << t.l << ", " << t.r << ", " << t.sum << ", " << t.ans << "}";
		}
	} val_t;
	typedef int opr_t;
	handler(){}
	static val_t def_val(){ return val_t(-INF); }
	static opr_t def_lazy(){ return INF; }
	static val_t resolve(const val_t &x, const opr_t &y, int l, int r){
		return y == INF ? x : 
				val_t(y <= 0 ? y : y * (r - l),
					 y <= 0 ? y : y * (r - l),
					 y * (r - l),
					 y <= 0 ? y : y * (r - l));
	}
	static opr_t push(const opr_t &x, const opr_t &y){
		return y == INF ? x : y;
	}
	static val_t merge(const val_t &l, const val_t &r){
		if(l.l == -INF) return r;
		if(r.l == -INF) return l;
		return val_t(max(l.l, l.sum+r.l),
					 max(r.r, r.sum+l.r),
					 max((ll)-INF, (ll)l.sum + r.sum),
					 max({l.ans, r.ans, l.r + r.l}));
	}
};

template<typename Handler>
struct WeightedSegtreeLazy{
	typedef typename Handler::val_t val_t;
	typedef typename Handler::opr_t opr_t;
	Handler hdl;
	struct Node{
		int lch, rch, c;
		val_t val;
		opr_t lazy;
		Node():lazy(Handler::def_lazy()){}
	};
	int root;
	int n;
	vector<Node> p;
	
	int construct(int v, int l, int r, const vector<val_t> &val, const vector<int> &weight){
		if(r - l == 1){
			p[v].c = 1;
			p[v].val = val[l];
			return ++v;
		}
//		int mid = upper_bound(weight.begin() + l, weight.begin() + r - 1, (weight[r-1] + weight[l])/2) - weight.begin();
		int mid = (l+r)/2;
		p[v].c = r - l;
		p[v].lch = v + 1;
		p[v].rch = construct(p[v].lch, l, mid, val, weight);
		int ret = construct(p[v].rch, mid, r, val, weight);
		p[v].val = Handler::merge(p[p[v].lch].val, p[p[v].rch].val);
		return ret;
	}
	
	WeightedSegtreeLazy(const vector<val_t> &val, vector<int> weight):hdl(){
		n = val.size();
		assert(n == weight.size());
		REP(i, n-1) weight[i+1] += weight[i];
		p.resize(2*n);
		int r = 0;
		construct(0, 0, n, val, weight);
	}
	
	
	void push(int v, int l, int r){
		if(r-l<=1 || p[v].lazy == hdl.def_lazy()) return ;
		p[p[v].lch].lazy = hdl.push(p[p[v].lch].lazy, p[v].lazy);
		p[p[v].rch].lazy = hdl.push(p[p[v].rch].lazy, p[v].lazy);
		p[p[v].lch].val = hdl.resolve(p[p[v].lch].val, p[v].lazy, l, l + p[p[v].lch].c);
		p[p[v].rch].val = hdl.resolve(p[p[v].rch].val, p[v].lazy, l + p[p[v].lch].c, r);
		p[v].lazy = hdl.def_lazy();
	}
	void update(int a,int b,const opr_t &x, int v,int l,int r){
		if(r<=a||b<=l) return ;
		if(a<=l&&r<=b){
			p[v].lazy = hdl.push(p[v].lazy, x);
			p[v].val = hdl.resolve(p[v].val, x, l, r);
			return ;
		}
		push(v, l, r);
		update(a, b, x, p[v].lch, l, l + p[p[v].lch].c);
		update(a, b, x, p[v].rch, l + p[p[v].lch].c, r);
		p[v].val = hdl.merge(p[p[v].lch].val, p[p[v].rch].val);
	}
	val_t query(int a,int b,int v,int l,int r, opr_t lazy){
		if(r<=a||b<=l) return hdl.def_val();
		if(a<=l&&r<=b) return hdl.resolve(p[v].val, lazy, l, r);
		lazy = hdl.push(p[v].lazy, lazy);
		return hdl.merge(query(a, b, p[v].lch, l, l + p[p[v].lch].c, lazy), 
						 query(a, b, p[v].rch, l + p[p[v].lch].c, r, lazy));
	}
	int update(int a, int b, opr_t x, int r = 0){update(a, b, x, 0, 0, n);}
	val_t query(int a, int b, int r = 0){	return query(a, b, 0, 0, n, hdl.def_lazy());}
	val_t operator[](size_t i){return query(i, i+1);}
	friend ostream& operator<<(ostream &os, WeightedSegtreeLazy<Handler> &t){
		REP(i, t.n) os << (i ? ", " : "[") << "(" << i << ")" << t.query(i, i+1);
		return os << "]";
	}
};

struct HLDecomp{
	struct NodeInfo{
		int idx, pos, cnt, par, heavy, depth;
	};
	int n;
	vector<NodeInfo> V;
	vector<vi> e;
	HLDecomp(const vector<vi> &g, int root = 0):n(g.size()), V(n){
		stack<int> st;
		st.push(root);
		V[root].depth = 0;
		V[root].par = -1;
		while(!st.empty()){
			int v = st.top(); st.pop();
			if(v<0){
				v = ~v;
				if(v != root) V[V[v].par].cnt += V[v].cnt;
				V[v].heavy = -1;
				int mc = 0;
				FOR(u, g[v])if(*u!=V[v].par && chmax(mc, V[*u].cnt)) V[v].heavy = *u;
			}else{
				V[v].cnt = 1;
				st.push(~v);
				FOR(u, g[v])if(*u!=V[v].par){
					V[*u].par = v;
					V[*u].depth = V[v].depth+1;
					st.push(*u);
				}
			}
		}
		st.push(root);
		while(!st.empty()){
			vi d;
			int v = st.top();st.pop();
			int p = V[v].par;
			for(;v>=0;v=V[v].heavy){
				FOR(u, g[v])if(*u!=V[v].par && *u!=V[v].heavy) st.push(*u);
				V[v].idx = e.size();
				V[v].pos = d.size();
				V[v].par = p;
				d.pb(v);
			}
			e.pb(d);
		}
	}
	size_t size(){return e.size();}
	const vi &operator[](int i) const{return e[i];}
	pii getPos(int v){return pii(V[v].idx, V[v].pos);}
	struct Path{
		int idx, s, t;
		Path(int idx, int s, int t):idx(idx), s(s), t(t){}
	};
	vector<tuple<int, int, int>> path(int u, int v){
		vector<tuple<int, int, int>> res, rev;
		while(V[u].idx!=V[v].idx){
			int pu = V[u].par;
			int pv = V[v].par;
			if((pu==-1 ? -1 : V[pu].depth) > (pv == -1 ? -1 : V[pv].depth)){
				res.eb(V[u].idx, V[u].pos, 0);
				u = V[u].par;
			}else{
				rev.eb(V[v].idx  ,0 ,V[v].pos);
				v = V[v].par;
			}
		}
		res.eb(V[u].idx, V[u].pos, V[v].pos);
		res.insert(res.end(), RALL(rev));
		return res;
	}
	
};

template<class H, class S>
struct SegTreeOnHLDecomp{
	typedef typename H::val_t val_t;
	typedef typename H::opr_t opr_t;
	vector<S> seg;
	HLDecomp hld;
	SegTreeOnHLDecomp(const vector<vi> &g, const vector<val_t> &val, int root=0)
		:hld(g, root){
		REP(i, hld.size()){
			vector<val_t> d;
			for(int v : hld[i]) d.pb(val[v]);
			vi w(d.size(), 1);
			REP(j, hld[i].size()-1) w[j] = hld.V[hld[i][j]].cnt - hld.V[hld[i][j+1]].cnt;
			seg.eb(d, w);
			reverse(ALL(d));
			reverse(ALL(w));
			seg.eb(d, w);
		}
	}
	void update(int u, int v, const opr_t &x){
		auto paths = hld.path(u, v);
		FOR(p, paths){
			int i, s, t;tie(i, s, t) = *p;
			if(s > t) swap(s, t);
			seg[2*i].update(s, t+1, x);
			seg[2*i+1].update(hld[i].size() - t - 1, hld[i].size() - s, x);
		}
	}
	val_t query(int u, int v){
		auto res = H::def_val();
		auto paths = hld.path(u, v);
		FOR(p, paths){
			int i, s, t; tie(i, s, t) = *p;
			if(s <= t) res = H::merge(res, seg[2*i].query(s, t+1));
			else res = H::merge(res, seg[2*i+1].query(hld[i].size()-1-s, hld[i].size()-t));
		}
		return res;
	}
};

int n, m;

int main(int argc, char *argv[]){
	scanf("%d%d", &n, &m);
	vector<handler::val_t> w;
	REP(i, n){
		int x;
		scanf("%d", &x);
		w.eb(x);
	}
	vector<vi> g(n);
	REP(i, n-1){
		int u, v;
		scanf("%d%d", &u, &v); u--; v--;
		g[u].pb(v);g[v].pb(u);
	}
	SegTreeOnHLDecomp<handler, WeightedSegtreeLazy<handler>> hldc(g, w);
	REP(i, m){
		int t, a, b, c;
		scanf("%d%d%d%d", &t, &a, &b, &c); a--; b--;
		if(t==1) hldc.update(a, b, c);
		else printf("%d\n", hldc.query(a, b).ans);
	}
	return 0;
}

Measured memory_bytes: 81168