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

def getLuckyNumberSum(max):
    l = []
    offset = int(math.log(max)/math.log(2)) + 1
    i = 0
    while i < offset:
        j = i + 1
        while j <= offset:
            l.append(2**i + 2**j)
            j += 1
        i += 1
    l.sort()
    d = {}
    s = 0
    for n in l:
        s += n
        d[n] = s
    #print d
    return d
    
def findNearest(k, n, ind, pos, l):
    left = 0
    right = l - 1
    if ind == 1:
        left = pos + 1
    else:
        right = pos
    old = -1
    while True:
        m = (left + right)/2
        if n == k[m]:
            return k[m]
        elif n > k[m]:
            left = m + 1
            old = k[m]
            #right = l - 1
        else:
            #left = 0
            right = m - 1
        if left >= l or right <= 0 or left > right:
            return old

n = int(raw_input())
d = getLuckyNumberSum(10**18)
l = d.keys()
l.sort()
length = len(l)
old = -1
#print l, d
while n > 0:
    c = int(raw_input())
    a = findNearest(l, c, -1, length, length)
    if a < 0:
        print 0
    else:
        print d[a] % 1000000007
    n -= 1