Long-Awaited Party
Sakurako is organizing a party for his friends after their Math test. He has friends in total. The mood of the -th friend is represented by an integer , and Sakurako's mood is zero.
The mood of the party at any moment is calculated as the bitwise XOR of the mood levels of all friends who have already arrived. Friends arrive at the party one by one, and no two friends arrive at the same time. For any specific order of arrival, Sakurako can calculate the total sum of the party's mood at each step.
For example, if Sakurako has three friends with moods respectively and they come to the party in the order , then the sum of moods at each step is .
However, since Sakurako doesn't know the exact order in which his friends will arrive, he wants to know the total sum of moods for all possible permutations of their arrival order.
Formally, Sakurako wants to calculate:
where is a group of all permutations of length .
Additionally, Sakurako sometimes gets curious about specific segments of his friends. He wants to know the total sum of moods if only friends with moods arrive at the party. He has such questions and asks you to answer them.
Since that sum may be too large, find it modulo .
Input
The first line contains two integers — the number of friends and the number of questions.
The second line contains integers — moods of Sakurako's friends.
Each of the next lines contains two integers describing the question.
Output
For each question, output the answer modulo .
Examples
Note
In the first sample test, all the friends come to the party. There are possible orderings of their arrival:
: the sum of moods at each step is ;
: the sum of moods at each step is ;
: the sum of moods is ;
: the sum of moods is ;
: the sum of moods is ;
: the sum of moods is .
Hence, the total sum of moods is .
Scoring
( points): ;
( points): ;
( points): ;
( points): ;
( points): ;
( points): ;
( points): without additional restrictions.