n,Q=map(int,input().split()) e=[[] for i in range(n)] for i in range(n-1): a,b=map(int,input().split()) a-=1 b-=1 e[a]+=[b] e[b]+=[a] v=[0]*n u=[0]*n p=[0]*n q=[0] while len(q)>0: s=q[-1] if v[s]==0: v[s]=1 for t in e[s]: if t!=p[s]: q+=[t] p[t]=s else: u[s]=1 for t in e[s]: if t!=p[s]: u[s]+=u[t] q.pop() g=0 for i in range(Q): p,x=map(int,input().split()) p-=1 g+=u[p]*x print(g)