There exits an edge-weighted directed tree rooted at node 1, where edges are directed from child towards the parent, and each edge has a positive weight. Let's call this tree Tree1.
There exists another tree, Tree2 which is constructed from Tree1 as: Copy entire Tree1 and double each of it's edge value (Edges remain directed in Tree2 as well).
There also exits an undirected weighted edge, with weight w[v] between node v of Tree1 and node v of Tree2, for all 1≤v≤n (where n is the number of nodes in the trees).
You will be given q queries of the form u, v where v will be ancestor of u. You will have to find the length of the shortest path from u to v in Tree2 (mean you've to start in node u in Tree2 and reach node v in Tree2).
Input Format
Output Format
For each query print a single integer in a separate line which is the answer to the query.
Constraints
1≤n,q≤3⋅1051≤u,v≤n1≤w[v],x≤109
Where (1) denotes node is in Tree1 and (2) denotes node is in Tree2.