#include using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x<(to);x++) #define FORR(x,arr) for(auto& x:arr) #define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++) #define ALL(a) (a.begin()),(a.end()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) //------------------------------------------------------- int N,Q; vector> E[101010]; ll D[101010]; int L[101010],R[101010]; int id; template class BIT { public: V bit[1< bta,btb; void dfs(int cur,int pre,int d) { D[cur]=d; L[cur]=id++; FORR(e,E[cur]) if(e.first!=pre) { int pa=id; dfs(e.first,cur,d+1); bta.add(pa,e.second); bta.add(id,-e.second); } R[cur]=id; } void solve() { int i,j,k,l,r,x,y; string s; cin>>N; FOR(i,N-1) { cin>>x>>y>>r; E[x].push_back({y,r}); E[y].push_back({x,r}); } dfs(0,0,0); cin>>Q; while(Q--) { cin>>i; if(i==1) { cin>>x>>y; btb.add(L[x],y); btb.add(R[x],-y); bta.add(L[x],-D[x]*y); btb.add(R[x],D[x]*y); } else { cin>>x; cout<