# Long-Awaited Party

Sakurako is organizing a party for his friends after their Math test. He has $n$ friends in total. The mood of the $i$-th friend is represented by an integer $a_{i}$, 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 $a_{1},a_{2},a_{3}$ respectively and they come to the party in the order $[3,1,2]$, then the sum of moods at each step is $a_{3}+(a_{3}⊕a_{1})+(a_{3}⊕a_{1}⊕a_{2})$.

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 $S_{n}$ is a group of all permutations of length $n$.

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 $a_{l},a_{l+1},…,a_{r}$ arrive at the party. He has $q$ such questions and asks you to answer them.

Since that sum may be too large, find it modulo $10_{9}+7$.

## Input

The first line contains two integers $n,q(1≤n,q≤2⋅10_{5})$ — the number of friends and the number of questions.

The second line contains $n$ integers $a_{1},a_{2},…,a_{n}(0≤a_{i}<2_{30})$ — moods of Sakurako's friends.

Each of the next $q$ lines contains two integers $l,r(1≤l≤r≤n)$ describing the question.

## Output

For each question, output the answer modulo $10_{9}+7$.

## Examples

## Note

In the first sample test, all the friends come to the party. There are $6$ possible orderings of their arrival:

$[1,2,3]$: the sum of moods at each step is $4+(4⊕7)+(4⊕7⊕1)=9$;

$[1,3,2]$: the sum of moods at each step is $4+(4⊕1)+(4⊕1⊕7)=11$;

$[2,1,3]$: the sum of moods is $7+(7⊕4)+(7⊕4⊕1)=12$;

$[2,3,1]$: the sum of moods is $7+(7⊕1)+(7⊕1⊕4)=15$;

$[3,1,2]$: the sum of moods is $1+(1⊕4)+(1⊕4⊕7)=8$;

$[3,2,1]$: the sum of moods is $1+(1⊕7)+(1⊕7⊕4)=9$.

Hence, the total sum of moods is $9+11+12+15+8+9=64$.

## Scoring

($15$ points): $n≤10,q=1$;

($56$ points): $a_{1}=a_{2}=⋯=a_{n}$;

($113$ points): $a_{i}∈{0,1},n≤1000,q=1$;

($47$ points): $n≤1000,q=1$;

($74$ points): $n⋅q≤5⋅10_{5}$;

($43$ points): $a_{i}∈{0,1}$;

($52$ points): without additional restrictions.