from bisect import bisect_right as br NN = 5 BIT1=[0]*(2**NN+1) BIT2=[0]*(2**NN+1) def addrange(l0, r0, x=1): l, r = l0, r0 while l <= 2**NN: BIT1[l] -= x * l0 BIT2[l] -= x l += l & (-l) while r <= 2**NN: BIT1[r] += x * r0 BIT2[r] += x r += r & (-r) def rangesum(l, r): l0, r0, a, b, c = l, r, 0, 0, 0 while l != 0: a -= BIT1[l] b += BIT2[l] l -= l&(-l) while r != 0: a += BIT1[r] c += BIT2[r] r -= r&(-r) return a + b * l0 - c * r0 BIT3=[0]*(2**NN+1) BIT4=[0]*(2**NN+1) def addrange2(l0, r0, x=1): l, r = l0, r0 while l <= 2**NN: BIT3[l] -= x * l0 BIT4[l] -= x l += l & (-l) while r <= 2**NN: BIT3[r] += x * r0 BIT4[r] += x r += r & (-r) def rangesum2(l, r): l0, r0, a, b, c = l, r, 0, 0, 0 while l != 0: a -= BIT3[l] b += BIT4[l] l -= l&(-l) while r != 0: a += BIT3[r] c += BIT4[r] r -= r&(-r) return a + b * l0 - c * r0 N = int(input()) X = [[] for i in range(N)] for i in range(N-1): x, y, d = map(int, input().split()) X[x].append((y, d)) X[y].append((x, d)) P = [(-1, 0)] * N Q = [(-1, 0), (0, 0)] ET = [] ct = 0 dd = 0 CTA = [0] * N CTB = [0] * N DE = [0] * N D = [0] * N de = -1 while Q: i, d = Q.pop() if i < 0: CTB[~i] = ct de -= 1 dd -= d continue if i >= 0: ct += 1 if CTA[i] == 0: CTA[i] = ct dd += d de += 1 DE[i] = de D[i] = dd for a, d in X[i][::-1]: if a != P[i][0]: ET.append((i, a)) P[a] = (i, d) for k in range(len(X[a])): if X[a][k][0] == i: del X[a][k] break Q.append((~a, d)) Q.append((a, d)) for _ in range(int(input())): tmp = [int(a) for a in input().split()] if tmp[0] == 1: a, x = tmp[1:] addrange(CTA[a]+1, CTB[a]+1, x) addrange2(CTA[a]+1, CTB[a]+1, x * DE[a]) else: b = tmp[1] print(D[b] + rangesum(CTA[b], CTA[b]+1) * DE[b] - rangesum2(CTA[b], CTA[b]+1))