Any integer A is said to be compatible with another integer B if A|B=A+B where A|B is the Bitwise OR of A and B.
You are given an array A of N integers. You are also given Q queries where each query has a single integer X. For each query find the sum of all the array elements which are compatible with X.
Input format
Output format
Print the answer for each query in a separate line — the sum of all the array elements which are compatible with X.
Constraints
1≤N≤1061≤Ai≤1061≤Q≤1061≤X≤106
The array is [1,2,3]. There are 3 queries.