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:
for _ in xrange(input()):
    n = input()
    b_n = bin(n)
    lim = len(b_n) - 2
    s = 0
    try:
        q = b_n[3:].index('1') + 1
        for j in xrange(0, q):
            s -= 2**(lim - 1) + 2**(lim - j - 1)
        s += 2**(lim - 1) + 2**(lim - 1)
    except:
        for j in xrange(1, lim):
            s -= 2**(lim - 1) + 2**(lim - j - 1)
    for i in xrange(lim - 1):
        s += (lim - i - 1) * 2**(lim - i - 1)
    s += 2**lim - lim - 1
    s = s % 1000000007
    print s