#include<bits/stdc++.h>
using namespace std;
using Int = long long;

template<typename T,typename E,typename F,typename G,typename H,typename S>
struct LinkCutTree{
  struct Node{
    Node *l,*r,*p;
    int idx;
    bool rev;
    T val,dat;
    E laz;
    Node(){}
    Node(int idx,T val,E laz):
      idx(idx),rev(0),val(val),dat(val),laz(laz){l=r=p=nullptr;}
    bool is_root(){
      return !p||(p->l!=this&&p->r!=this);
    }
  };
  
  //using F = function<T(T,T)>;
  //using G = function<T(T,E)>;
  //using H = function<E(E,E)>;
  //using S = function<T(T)>;
  F f;
  G g;
  H h;
  S s;
  T ti;
  E ei;
  
  const size_t LIM = 1e6;
  vector<Node> pool;
  size_t ptr;
  
  
  LinkCutTree(F f,G g,H h,T ti,E ei):
    f(f),g(g),h(h),ti(ti),ei(ei),pool(LIM),ptr(0){
    s=[](T a){return a;};
  }
  
  LinkCutTree(F f,G g,H h,S s,T ti,E ei):
    f(f),g(g),h(h),s(s),ti(ti),ei(ei),pool(LIM),ptr(0){}
  
  inline Node* create(){
    return &pool[ptr++];
  }
  
  inline Node* create(int idx,T v){
    return &(pool[ptr++]=Node(idx,v,ei));
  }

  void propagate(Node *t,E v){
    t->laz=h(t->laz,v);
    t->val=g(t->val,v);
    t->dat=g(t->dat,v);
  }

  void toggle(Node *t){
    swap(t->l,t->r);
    t->dat=s(t->dat);
    t->rev^=1;
  }

  void eval(Node *t){
    if(t->laz!=ei){
      if(t->l) propagate(t->l,t->laz);
      if(t->r) propagate(t->r,t->laz);
      t->laz=ei;
    }
    if(t->rev){
      if(t->l) toggle(t->l);
      if(t->r) toggle(t->r);
      t->rev=false;
    }
  }

  void update(Node *t){
    t->dat=t->val;
    if(t->l) t->dat=f(t->l->dat,t->dat);
    if(t->r) t->dat=f(t->dat,t->r->dat);
  }

  void rotR(Node *t){
    Node *x=t->p,*y=x->p;
    if((x->l=t->r)) t->r->p=x;
    t->r=x;x->p=t;
    update(x);update(t);
    if((t->p=y)){
      if(y->l==x) y->l=t;
      if(y->r==x) y->r=t;
      update(y);
    }
  }
  
  void rotL(Node *t){
    Node *x=t->p,*y=x->p;
    if((x->r=t->l)) t->l->p=x;
    t->l=x;x->p=t;
    update(x);update(t);
    if((t->p=y)){
      if(y->l==x) y->l=t;
      if(y->r==x) y->r=t;
      update(y);
    }
  }

  void splay(Node *t){
    eval(t);
    while(!t->is_root()){
      Node *q=t->p;
      if(q->is_root()){
	eval(q);eval(t);
	if(q->l==t) rotR(t);
	else rotL(t);
      }else{
	auto *r=q->p;
	eval(r);eval(q);eval(t);
	if(r->l==q){
	  if(q->l==t) rotR(q),rotR(t);
	  else rotL(t),rotR(t);
	}else{	
	  if(q->r==t) rotL(q),rotL(t);
	  else rotR(t),rotL(t);
	}
      }
    }
  }

  Node* expose(Node *t){
    Node *rp=nullptr;
    for(Node *c=t;c;c=c->p){
      splay(c);
      c->r=rp;
      update(c);
      rp=c;
    }
    splay(t);
    return rp;
  }

  void link(Node *par,Node *c){
    expose(c);
    expose(par);
    c->p=par;
    par->r=c;
  }

  void cut(Node *c){
    expose(c);
    Node *par=c->l;
    c->l=nullptr;
    par->p=nullptr;
  }

  void evert(Node *t){
    expose(t);
    toggle(t);
    eval(t);
  }

  bool is_connected(Node *a,Node *b){
    expose(a);
    while(a->l) a=a->l;
    expose(b);
    while(b->l) b=b->l;
    return a==b;
  }

  Node *lca(Node *a,Node *b){
    expose(a);
    return expose(b);
  }

  void set_propagate(Node *t,E v){
    expose(t);
    propagate(t,v);
    eval(t);
  }
};

//INSERT ABOVE HERE


signed main(){
  int n,q;
  scanf("%d %d",&n,&q);

  using T = tuple<int,int,int,int,int,int,int>;
  using P = pair<int,int>;
  
  T d1(-1,-1,-1,-1,-1,-1,-1);
  P d0(-1,-114514);
  
  auto f=[&](T a,T b){
	   int al,ar,as,ava,avi,avl,avr;
	   tie(al,ar,as,ava,avi,avl,avr)=a;
	   int bl,br,bs,bva,bvi,bvl,bvr;
	   tie(bl,br,bs,bva,bvi,bvl,bvr)=b;
	   int cl=al,cr=br,cs=as+bs;
	   int cva=ava+bva,cvi=max(avi,bvi),cvl=avl,cvr=bvr;
	   cvi=max(cvi,avr+bvl);
	   cvl=max(cvl,ava+bvl);
	   cvr=max(cvr,avr+bva);
	   return T(cl,cr,cs,cva,cvi,cvl,cvr);
	 };
  
  auto g=[&](T a,P p){
	   if(p==d0) return a;
	   int al,ar,as,ava,avi,avl,avr;
	   tie(al,ar,as,ava,avi,avl,avr)=a;
	   int v=p.first,b=p.second;
	   if(~v) al=ar=v,as=1;
	   if(b>=0) return T(al,ar,as,b*as,b*as,b*as,b*as);
	   return T(al,ar,as,b*as,b,b,b);
	 };
  
  auto h=[&](P a,P b){a.first++;return b;};
  auto s=
    [&](T a){      
      int al,ar,as,ava,avi,avl,avr;
      tie(al,ar,as,ava,avi,avl,avr)=a;
      swap(al,ar);
      swap(avl,avr);
      return T(al,ar,as,ava,avi,avl,avr);
    };
  
  using LCT = LinkCutTree<T, P, decltype(f),decltype(g),decltype(h),decltype(s)>;

  vector<vector<int> > G(n); 
  
  vector<LCT::Node* > vs(n);
  vector<int> ps(n,-1);
  
  
  LCT lct(f,g,h,s,d1,d0);
  
  vector<int> w(n);
  for(int i=0;i<n;i++) scanf("%d",&w[i]);
  for(int i=0;i<n;i++) vs[i]=lct.create(i,g(d1,P(i,w[i])));
  
  for(int i=0;i<n-1;i++){
    int a,b;
    scanf("%d %d",&a,&b);
    a--;b--;
    G[a].emplace_back(b);
    G[b].emplace_back(a);
  }

  for(int i=0;i<n;i++)
    sort(G[i].begin(),G[i].end());

  {
    queue<P> q;
    q.emplace(0,-1);
    while(!q.empty()){
      int v,p;
      tie(v,p)=q.front();q.pop();
      if(~p) lct.link(vs[p],vs[v]);
      ps[v]=p;
      for(int u:G[v]){
	if(u==p) continue;
	q.emplace(u,v);
      }
    }
  }
  
  while(q--){
    int t,a,b,c;
    scanf("%d %d %d %d",&t,&a,&b,&c);
    a--;b--;
    if(t==1){
      lct.evert(vs[a]);
      lct.set_propagate(vs[b],P(-1,c));      
    }
    if(t==2){
      lct.evert(vs[a]);
      lct.expose(vs[b]);
      int vva,vvi,vvl,vvr;
      tie(ignore,ignore,ignore,vva,vvi,vvl,vvr)=vs[b]->dat;
      printf("%d\n",max({vva,vvi,vvl,vvr}));
    }
  }
  
  return 0;
}



Measured memory_bytes: 113152