NN = 17 BIT=[0]*(2**NN+1) BIT2=[0]*(2**NN+1) def addrange(l0, r0, x=1): l, r = l0, r0 while l <= 2**NN: BIT[l] += x l += l & (-l) while r <= 2**NN: BIT[r] -= x r += r & (-r) def getvalue(r): a = 0 while r != 0: a += BIT[r] r -= r&(-r) return a def addrange2(l0, r0, x=1): l, r = l0, r0 while l <= 2**NN: BIT2[l] += x l += l & (-l) while r <= 2**NN: BIT2[r] -= x r += r & (-r) def getvalue2(r): a = 0 while r != 0: a += BIT2[r] r -= r&(-r) return a 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] + getvalue(CTA[b]) * DE[b] - getvalue2(CTA[b]))