Given a rooted tree with integers assigned to its nodes, for each internal node, find the minimum absolute difference between numbers in any two distinct vertices within its subtree.
The first line contains the number of vertices in the tree, (1 \le n \le 40000). The next lines each contain two integers: p_i and v_i (0 \le i < n). Here, p_i is the number of the parent of vertex . If p_i = -1, then this vertex is the root. The integer v_i is the value stored at vertex (0 \le v_i \le 10^6).
Print a single number:

Output the answer modulo . Here, the set refers to the indices of the internal vertices, and a_i is the answer for vertex . Use q = 127 and P = 1000000007.
Example 1