You are given an integer array A of length N and M queries. For each query, you are given three integers L,R,X and you should find the number of triplets (i,j,k) such that (L≤i,j,k≤R) and (Ai&Aj&Ak=X).
Symbol & denotes bitwise operator AND.
Input format:
First line contains one integer N (1≤N≤100000).
Next line contains N space-separated integers denoting the array A (0≤Ai≤255).
The next line contains one integer M (1≤M≤50000).
Next M lines contains three space-separated integers L,R,X (1≤L≤R≤N,0≤X≤255)
Output format:
For each query, print the required answer modulo 109+7 in a new line.
For 8-th query, there are 6 triplets: (2,2,3), (2,3,2), (2,3,3), (3,2,2), (3,2,3), (3,3,2).