There are total squares numbered from to . You start at square . Also there are ladders, where i-th ladder is denoted by two integers: , it means that the ladder starts at square and ends at ( ). There is no such square where more than one ladder starts, and also, the starting square of any ladder is not the same as the ending square of any other ladder. Now in every move, you can move ahead by 1, 2, 3, 4, 5 or 6 squares. If you land on a square where any ladder starts, then you will climb that ladder and directly get transported to the square where that ladder ends. You cannot move beyond square , (for e.g., if you are at square , then you have only one option - to move to square ).
For each ladder , you have to find out the number of ways to reach from square to square , in which you have climbed (used) ladder . It doesn't matter if you used the other ladders or not. Since the answer can be large, print your answer modulo .
Input
Output
Print lines, the of which contains a single integer - the number of ways to reach the square N while having climbed ladder (modulo ). Also print a new-line at the end.
Constraints
For the first ladder, the 4 possible ways are:
for the second ladder, the only possible way is: