#include #include #include using namespace std; using namespace atcoder; using mint = modint998244353; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 4000000000000000001 using P = pair ; mint op(mint a,mint b){ return a+b; } mint e(){ return 0; } mint mapping(P a,mint b){ return a.first * b + a.second; } P composition(P a,P b){ return make_pair(b.first * a.first, b.second * a.first + a.second); } P id(){ return make_pair(1,0); } vector ps; vector l0,r0,l1,r1; vector> E; vector is; vector pos; void dfs(int cv,int pv){ ps[cv] = pv; l0[cv] = is.size(); l1[cv] = is.size(); rep(i,E[cv].size()){ int to = E[cv][i]; if(to==pv)continue; pos[to] = is.size(); is.push_back(to); } r0[cv] = is.size(); rep(i,E[cv].size()){ int to = E[cv][i]; if(to==pv)continue; dfs(to,cv); } r1[cv] = is.size(); } int main(){ int n,q; cin>>n>>q; E.resize(n); rep(i,n-1){ int a,b; cin>>a>>b; a--,b--; E[a].push_back(b); E[b].push_back(a); } l0.resize(n); l1.resize(n); r0.resize(n); r1.resize(n); ps.resize(n); is.push_back(0); pos.resize(n); pos[0] = 0; dfs(0,-1); vector x(n); rep(i,n){ int a; cin>>a; x[pos[i]] = a; } lazy_segtree seg(x); rep(_,q){ int t; cin>>t; if(t==1){ int x; cin>>x; x--; cout<>v>>k>>c>>d; v--; seg.apply(l0[v],r0[v],make_pair(c,d)); seg.apply(pos[v],make_pair(c,d)); if(v!=0)seg.apply(pos[ps[v]],make_pair(c,d)); } if(t==3){ int v,c,d; cin>>v>>c>>d; v--; seg.apply(l1[v],r1[v],make_pair(c,d)); seg.apply(pos[v],make_pair(c,d)); } } return 0; }