MianKing has a tree with

nodes. And he has one black chess and one white chess, both of the chess are initially on some nodes of the tree.
Now MianKing will do the following operation until the black chess and the white chess are on the same node: If the black chess is on node

, let

denote the set of nodes which connect to

directly. Then MainKing will choose a node of

randomly and move the black chess to it.
Let

denote the number of operations MianKing did, now let
)
denote the expectation of

when the black chess is on node

and the white chess is on node

initially.
Let
)
denote the set of all of the nodes in the subtree of

when the root is node

. Now MainKing wants you to answer

questions, each question formed by two integers

,

and you need to answer
It's guaranteed that
%5Ccap%20Sub(y)%3D%5Cemptyset)
for each questions.
If the answer is irreducible fraction

, you need to output an integer

in

which satisfies

. It's guaranteed that