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:
import math, bisect
temp , a , b , A , F = 1, [], [], [], {}
while temp < 10**20:
	a.append(temp)
	temp=temp*2
for i in range(len(a)):
	for j in range(i+1,len(a)):
		b.append(a[i] + a[j])
b = sorted(b)
for i in range(len(b)):
	if(i==0): A.append(b[i])
	else: A.append(A[i-1] + b[i])
#	print A[i]
for _ in range(input()):
	x = input()
	if x < 3: print 0
	else: print A[bisect.bisect(b,x) - 1]%(10**9 + 7)