Daniel and sszcdjr are playing a game. The game is played on a sequence

of length

. Initially, all elements in

are equal to

. They will do the following operations

times on it:
* Daniel selects one segment
![[l_i,r_i]](https://www.nowcoder.com/equation?tex=%5Bl_i%2Cr_i%5D)
(

);
* Then, sszcdjr chooses a real number

such that

\bf{uniformly at random};
* For all

, set

.
However, sszcdjr thinks it is unfair for him. So he adds a rule: for any two segments
![[l_i,r_i]](https://www.nowcoder.com/equation?tex=%5Bl_i%2Cr_i%5D)
and
![[l_j,r_j]](https://www.nowcoder.com/equation?tex=%5Bl_j%2Cr_j%5D)
(

), one of the following condition must holds:
* The two segments are completely disjoint. More formally, either

or

;
* One of the two segments are inside another. More formally, either

or

.
Note that two segments can be exactly the same.
Let

be the maximum number in

after the operations. zxx is crazy about probabilities, so he gives you

queries. In each query, he gives you two numbers

,

, and asks you the probability that

. You just need to tell him the answer modulo

.