You are given a weighted tree with n vertices. In this tree:
- d(u,v) represents the weight of the minimum edge on the simple path from vertex u to vertex v.
Your task is to handle q queries of the form (u,k), count the number of vertices v for which d(u,v)=k.
- The first line contains two integers n,q.
- The next n−1 lines, each line contains three integers u,v,w, there is an edge of weight w between u and v.
- The next q lines, each line contains two integers u,k, a query.
Output
- Print an integer is the answer for each query.
Constraints
- 1≤n,q≤105.
- 1≤u,v≤n.
- 1≤w,k≤n.
Example
Input:
4 2
1 2 1
2 3 2
2 4 3
3 2
2 1
Output:
2
1