n,q = map(int,input().split()) l = [[] for _ in range(n)] for _ in range(n-1): a,b = map(int,input().split()) l[a-1].append(b-1) l[b-1].append(a-1) ans = 0 ne = [1] + [0] * (n - 1) def dfs(node): res = 1 for nd in l[node]: if ne[nd] == 0: ne[nd] = 1 res += dfs(nd) ne[node] = res return res dfs(0) for _ in range(q): p,x = map(int,input().split()) ans += ne[p-1] * x print(ans)