#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //eolibraries #define lnf 3999999999999999999 #define inf 999999999 #define fi first #define se second #define pb push_back #define ll long long #define ld long double #define all(c) (c).begin(),(c).end() #define sz(c) (int)(c).size() #define make_unique(a) sort(all(a)),a.erase(unique(all(a)),a.end()) #define pii pair #define rep(i,n) for(int i = 0 ; i < n ; i++) #define drep(i,n) for(int i = n-1 ; i >= 0 ; i--) #define crep(i,x,n) for(int i = x ; i < n ; i++) #define vi vector #define vec(...) vector<__VA_ARGS__> #define _3fFlcJq ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0) //eodefine using namespace std; const int mxn=12000; int main(){ _3fFlcJq; int n,q; cin>>n>>q; vec(vi) adj(n,vi()); rep(i,n-1){ int u,v; cin>>u>>v; u--,v--; adj[u].pb(v); adj[v].pb(u); } vi dp(n,0); auto dfs=[&](auto self,int v,int par)->void{ dp[v]=1; for(auto u : adj[v]){ if(u==par) continue; self(self,u,v); dp[v]+=dp[u]; } }; dfs(dfs,0,-1); ll ans=0; rep(i,q){ ll v,cost; cin>>v>>cost; v--; ans+=(ll)dp[v]*cost; cout<