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 sys
bits = [2**e for e in xrange(64)]
lucky = [-1]
prefix_sum = [0]
for i in xrange(1, 64):
	base = bits[i]
	for j in xrange(i):
		lucky.append(base + bits[j])
		prefix_sum.append((prefix_sum[-1] + lucky[-1])%1000000007)

t = int(sys.stdin.readline())
for _ in xrange(t):
	n = int(sys.stdin.readline())
	start = 0
	end = len(lucky)-1
	while start <= end:
		mid = start + (end-start)/2
		if lucky[mid] <= n and lucky[mid+1] > n:
			print prefix_sum[mid]
			break
		if lucky[mid] > n:
			end = mid-1
		else:
			start = mid+1