# -*- coding: utf-8 -*-
"""
Created on Sat Jan  4 21:05:55 2020

@author: USER
"""

A=list(map(int,input().split()))
a=max(A)
v=0
u=0
while v==0:
    if a<2**u:
        v=1
    else:
        u=u+1
u=u-1
e=0
for i in range(u+1):
     c=0
     d=0
     for s in range(len(A)):
        if A[s]//2**(u-i)==1:
            c=c+1
            A[s]=A[s]%2**(u-i)
        else:
            d=d+1
     e=e+c*d*2**(u-i)
print(e%(10**9+7))
    
            
        
    
