Anchal lives in a city which has N ice cream parlours. The city has N−1 connections such that every ice cream parlour can be reached from every other ice cream parlour. Each parlour has only one type of ice cream with cost Ci for each 1≤i≤N. Anchal has Q queries with each query specifying a city R and two integers X and Y. In every query she wants to reach the same destination ice cream parlour D.Anchal wants to calculate the number of cities from which she can start her journey and reach the destination city D along the shortest path between the source and the destination city such that city R lies in its path and the sum of ice creams for these three cities lie between X and Y (Both inclusive).
Note : City D , City R and the city from which Anchal starts are pairwise distinct.
INPUT FORMAT
where ⊕ is the symbol for logical XOR.
OUTPUT FORMAT
For each query, print the answer to it on a separate line
CONSTRAINTS
SUBTASKS
For the first query : R = 6 , X = 5 and Y = 9. Also , D=1. Clearly there is no node from which we can start and reach node 1 via node 6. Hence ans is 0