Problem: Golu wants to find out the sum of Lucky numbers.Lucky numbers are those numbers which contain exactly two set bits.This task is very diffcult for him.So Help Golu to find sum of those numbers which exactly contain two set bits upto a given number N.

3 5 10 are lucky numbers where 7 14 are not.

INPUT First line contain number of test cases T.Each test case contains a single number N.
OUTPUT Print sum of all Lucky Numbers upto N.Output may be large so take modulo with 1000000007.  
Constraints 

1 ≤ T ≤ 10^5
1 ≤ N ≤ 10^18

NOTE: Since value of test cases and n is really large, please use fast I/O optimization techniques. 

SAMPLE INPUT
1
5

SAMPLE OUTPUT
8

Solution (in PYTHON):

Solution:
arr=[1]
i,j,t=0,0,2
art=[]
sumarr=[]

def binarysearch(a,t):
    low=0
    high=len(a)-1
    while low<=high:
        mid=(low+high)/2
        if t==a[mid]:
            #print mid
            return mid+1
        elif t<a[mid]:
            high=mid-1
        else:
            low=mid+1
    
    if a[mid]<t:
        return mid+1
    else:
        return mid
#powers of 2 array
for i in range(60):
	arr.append(t)
	t=t*2

#lucky numbers array
i=0
while i<len(arr):
	j=0
	while j<i:
		art.append(arr[i]+arr[j])
		#print arr[i],arr[j]
		j+=1
	i+=1

#sum of lucky numbers array
temp=0
for item in art:
	temp+=item
	sumarr.append(temp)
#print sumarr[:20]
#print art[:20]
for _ in range(input()):
	n=input()
	if n==1 or n==2:
		print 0
	else:
		x=binarysearch(art,n)-1
		#print n,
		#print x,
		
		print sumarr[x]%1000000007