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 <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

const ll INF=1e18;

struct State{
    ll sum,lef,rig,ans;
    State():sum(0),lef(-INF),rig(-INF),ans(-INF){}

    void  reset(ll val,int len){
        sum=val*len;
        ans=max(sum,val);
        if(val>=0){
            lef=sum;
            rig=sum;
        }else{
            lef=val;
            rig=val;
        }
    }
};

State merge(State l,State r){
    State res;
    res.sum=l.sum+r.sum;
    res.lef=max(l.lef,l.sum+r.lef);
    res.rig=max(r.rig,r.sum+l.rig);
    res.ans=max(max(l.ans,r.ans),l.rig+r.lef);
    return res;
}

class LazySegmentTree{
private:
  int n;
  vector<ll> lazy;
  vector<State> node;
  State zero;

public:
  LazySegmentTree(vector<ll> v){
      n=1;
      while(n<v.size()) n*=2;
      node.resize(2*n-1);
      lazy.resize(2*n-1,-INF);
      
      for(int i=0;i<v.size();i++) node[i+n-1].reset(v[i],1);
      for(int i=n-2;i>=0;i--) node[i]=merge(node[2*i+1],node[2*i+2]);
  }

  void eval(int k,int l,int r){
      if(lazy[k]!=-INF){
          node[k].reset(lazy[k],r-l);
          if(r-l>1){
              lazy[2*k+1]=lazy[k];
              lazy[2*k+2]=lazy[k];
          }
          lazy[k]=-INF;
      }
  }

  void update(int a,int b,ll x,int k=0,int l=0,int r=-1){
      if(r<0) r=n;
      eval(k,l,r);
      if(b<=l||r<=a) return;
      if(a<=l&&r<=b){
          lazy[k]=x;
          eval(k,l,r);
      }else{
          update(a,b,x,2*k+1,l,(r+l)/2);
          update(a,b,x,2*k+2,(r+l)/2,r);
          node[k]=merge(node[2*k+1],node[2*k+2]);
      }
  }

  State query(int a,int b,int k=0,int l=0,int r=-1){
      if(r<0) r=n;
      eval(k,l,r);
      if(b<=l||r<=a) return zero;
      if(a<=l&&r<=b) return node[k];

      State vl,vr;
      vl=query(a,b,2*k+1,l,(l+r)/2);
      vr=query(a,b,2*k+2,(l+r)/2,r);
      return merge(vl,vr);
  }
};

struct Edge{
    int to,id;
    ll dist;
    Edge(int to,ll dist=1,int id=0):to(to),dist(dist),id(id){}
};

// this class's update method is empty.
struct HeavyLightDecomposition{
    vector<vector<Edge>> g;
    vector<int> in,out,head,par,dep,sz;
    int times;
    int root;

    HeavyLightDecomposition(int V,vector<vector<Edge>> &G,int root=0):
        g(G),in(V),out(V),head(V),par(V),dep(V),sz(V),root(root){
            times=0;
            sz_dfs(root,-1);
            hld_dfs(root,-1);
    }
    
    void sz_dfs(int now,int p){
        par[now]=p;
        sz[now]=1;
        if(p==-1) dep[now]=0;
        else dep[now]=dep[p]+1;

        for(auto &e:g[now]){
            if(e.to==p) continue;
            sz_dfs(e.to,now);
            sz[now]+=sz[e.to];
            if(sz[e.to]>sz[g[now][0].to]) swap(e,g[now][0]);
        }
    }

    void hld_dfs(int now,int p){
        in[now]=times++;
        for(auto e:g[now]){
            if(e.to==p) continue;
            head[e.to]=(e.to == g[now][0].to ? head[now] : e.to);
            hld_dfs(e.to,now);
        }
        out[now]=times;
    }


    int lca(int u,int v){
        for(;;v=par[head[v]]){
            if(in[u]>in[v]) swap(u,v);
            if(head[u]==head[v]) return u;
        }
    }
    int distance(int u,int v){
        return dep[u]+dep[v]-2*dep[lca(u,v)];
    }

    /*ex)
        hld.update(u,x,[&](int a,int b,ll x){
            seg.add(a,b,x);
        });
    */
    template<class T,class G>
    void update(int u,int v,const T &x,const G &g){//辺の時は0を使わない(INFのまま)
        //g(in[v]+1,out[v],x);//部分木(辺)
        //g(in[v],out[v],x);//部分木（頂点）
        //g(in[v],in[v]+1,x);//一点
        for(;;v=par[head[v]]){
            if(in[u]>in[v]) swap(u,v);
            if(head[u]==head[v]) break;
            g(in[head[v]],in[v]+1,x);
        }
        g(in[u],in[v]+1,x);
    }

    /*ex)
        ll ans=0;
        hld.query(u,v,[&](int a,int b){
            ans+=seg.getSum(a,b);
        },true);
    */
    template<class F>
    pair<State,State> query(int u,int v,const F &f,bool isedge){
        State l,r;
        for(;;v=par[head[v]]){
            if(in[u]>in[v]){
                swap(u,v);
                swap(l,r);
            }
            if(head[u]==head[v]) break;
            r=merge(f(in[head[v]],in[v]+1),r);
        }
        if(isedge&&u==v) return mkp(l,r);
        r=merge(f(in[u]+isedge,in[v]+1),r);
        return mkp(l,r);
    }
};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  int N,Q;
  cin>>N>>Q;
  vector<ll> W(N);
  rep(i,N) cin>>W[i];
  vector<vector<Edge>> g(N);
  rep(i,N-1){
      int a,b;
      cin>>a>>b;
      a--;b--;
      g[a].push_back(b);
      g[b].push_back(a);
  }
  
  HeavyLightDecomposition hld(N,g);

  vector<ll> v(N,0);
  rep(i,N) v[hld.in[i]]=W[i];
  LazySegmentTree seg(v);

  rep(q,Q){
      int t,a,b,c;
      cin>>t>>a>>b>>c;
      a--;b--;
      
      if(t==1){
          hld.update(a,b,c,[&](int a,int b,ll x){
              seg.update(a,b,x);
          });
      }else{
          State l,r;
          tie(l,r)=hld.query(a,b,[&](int a,int b){
              return seg.query(a,b);
          },false);
          swap(l.lef,l.rig);
          State res=merge(l,r);
          cout<<res.ans<<endl;
      }
  }

  return 0;
}

