Define the value of a permutation of elements as the number of subintervals where the number of inversions do not exceed . That is, .
For example, if , and K=0, then (the valid intervals are ).
Now you are given queries. Each query you will receive and , and you need to calculate the sum of value of all permutations of .
Input
First line contains an integer .
Each of the next lines contain two integers, and .
Output
lines, line contains the answer of query, modulo .
Constraints
In the first query, and , so and , thus the answer is 5.