You are given an array A[] of size N. Now you are given Q queries to be performed over this array. In each query, you are given 2 space separated integers L and R. For each query, you need to you need to find the summation of the xor-sum of all triplets (i,j,k) of the sub-array L...R , where L≤i<j<k≤R.
In short, you need to find ∑(A[i]⊕A[j]⊕A[k]), over all triplets (i,j,k) , such that L≤i<j<k≤R . Print the answer for each query , Modulo 109+7
Input Format
The first line contains a single integer N.
The next line contains array A[] of N integers.
The next line contains 2 space separated integers Q and 2.
Each of the next Q lines contains two space separated integers L and R
Output Format :
Print Q lines, the ith line denoting the answer to the ith query, Modulo 109+7
Input Constraints :
1≤N,Q≤105
1≤A[i]≤1012
1≤L≤R≤N
(1⊕2⊕3)+(2⊕3⊕4)+(1⊕2⊕4)+(1⊕3⊕4)=18