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:
__author__ = 'legion'

from sys import stdin, stdout
import itertools

def kbits(n, k):
    result = []
    for bits in itertools.combinations(range(n), k):
        s = ['0'] * n
        for bit in bits:
            s[bit] = '1'
        s = int((''.join(s)), 2)
        result.append(s)
    return create_dict(result)


def create_dict(result):
    set_bits_sum = dict()
    set_bits_sum[result[len(result) - 1]] = result[len(result) - 1]
    i = len(result) - 2
    while i >= 0:
        set_bits_sum[result[i]] = (set_bits_sum[result[i + 1]] + result[i]) % (10 ** 9 + 7)
        i -= 1
    return set_bits_sum


def is_power2(num):
    return ((num & (num - 1)) == 0) and num > 0


def nearest_key(key):
    if is_power2(key):
        return (3 * key) / 4
    else:
        binary_no = "{0:b}".format(key)
        split_list = list(binary_no)
        i = 0
        counter = 0
        while i < len(split_list):
            if (counter != 2) and (split_list[i] == '1'):
                counter += 1
            elif counter == 2:
                split_list[i] = '0'
            i += 1
        return int((''.join(split_list)), 2)


set_dict_keys = kbits(63, 2)

iteration = int(stdin.readline())
for num in xrange(iteration):
    input_no = int(stdin.readline())
    if input_no < 3:
        stdout.write(str(0) + "\n")
    else:
        stdout.write(str(set_dict_keys[nearest_key(input_no)]) + "\n")