#include using namespace std; //#include #include using namespace atcoder; //using mint = modint998244353; //多倍長整数// //#include //namespace mp = boost::multiprecision; //using Bint = mp::cpp_int; const int INF = 1e9; const int MOD = 998244353; const long long LINF = 4e18; using ll = long long; using vi = vector; using vl = vector; using vs = vector; using vc = vector; using vb = vector; using vvi = vector>; using vvvi = vector>>; using vvvvi = vector>>>; using vvl = vector>; using vvvl = vector>>; using vvvvl = vector>>>; using vvc = vector>; using vvb = vector>; using vvvb = vector>>; using vvvvb = vector>>>; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define dump(x) cout << #x << " = " << (x) << endl; #define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl #define ALL(obj) (obj).begin(),(obj).end() //https://beet-aizu.github.io/library/tree/heavylightdecomposition.cpp class HLD{ private: void dfs_sz(int v) { auto &es=G[v]; if(~par[v]) es.erase(find(es.begin(),es.end(),par[v])); for(int &u:es){ par[u]=v; dfs_sz(u); sub[v]+=sub[u]; if(sub[u]>sub[es[0]]) swap(u,es[0]); } } void dfs_hld(int v,int &pos) { vid[v]=pos++; inv[vid[v]]=v; for(int u:G[v]){ if(u==par[v]) continue; nxt[u]=(u==G[v][0]?nxt[v]:u); dfs_hld(u,pos); } } public: vector< vector > G; // vid: vertex -> idx // inv: idx -> vertex vector vid,nxt,sub,par,inv; HLD(int n):G(n),vid(n,-1),nxt(n),sub(n,1),par(n,-1),inv(n){} void add_edge(int u,int v) { G[u].emplace_back(v); G[v].emplace_back(u); } void build(int r=0) { int pos=0; dfs_sz(r); nxt[r]=r; dfs_hld(r,pos); } int lca(int u,int v){ while(1){ if(vid[u]>vid[v]) swap(u,v); if(nxt[u]==nxt[v]) return u; v=par[nxt[v]]; } } template void for_each(int u,int v,const F& f) { while(1){ if(vid[u]>vid[v]) swap(u,v); f(max(vid[nxt[v]],vid[u]),vid[v]+1); if(nxt[u]!=nxt[v]) v=par[nxt[v]]; else break; } } template void for_each_edge(int u,int v,const F& f) { while(1){ if(vid[u]>vid[v]) swap(u,v); if(nxt[u]!=nxt[v]){ f(vid[nxt[v]],vid[v]+1); v=par[nxt[v]]; }else{ if(u!=v) f(vid[u]+1,vid[v]+1); break; } } } }; fenwick_tree fw(2e5); HLD hld(2e5); ll ans; void f(int a,int b){ ans += fw.sum(a,b); } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n,q; cin >> n >> q; vl a(n); vl sum(n); rep(i,n) cin >> a[i]; rep(i,n - 1){ int u,v; cin >> u >> v; u--;v--; hld.add_edge(u,v); } hld.build(); for(int i = 1;i < n;i++) sum[hld.par[i]] += a[i]; rep(i,n) fw.add(hld.vid[i],sum[i]); for(;q--;){ int op; cin >> op; if(op == 0){ int p; ll x; cin >> p >> x; p--; a[p] += x; if(p != 0) fw.add(hld.vid[hld.par[p]],x); }else{ int u,v; cin >> u >> v; u--;v--; ans = 0; hld.for_each(u,v,f); ans += a[hld.lca(u,v)]; if(hld.lca(u,v) != 0) ans += a[hld.par[hld.lca(u,v)]]; cout << ans << "\n"; } } return 0; }