There is a country consisting of cities numbered with integer numbers from to with values , and bidirectional roads connecting them, such that we can travel between any two cities using these roads. In other words, these cities and roads form a tree.
Arya is currently on vacation and plans to visit either city or city . He wants to choose some starting points on the shortest path between and (excluding city ) so that he can visit at least one of the cities, or , without passing through a city with a value less than . This means he must not stay or pass through a city (including destition city or city ) that has a value less than .
You will be given queries. Every query contains three integers denoting two cities and value . Your task is to help him find the count of the possible starting points for each query.
Input format
Output format
For each query, print the count of possible cities in a new line.
Constraints