l, r = map(int, input().split())
import math

ans = 0
inf = math.ceil(math.log(l, 2))
sup = math.floor(math.log(r+1, 2)) - 1
for i in range(inf, sup+1):
  ans += 3 ** i

for i in range(l, 2 ** inf):
  n = bin(i).count('0') - 1
  ans += 2 ** n

for i in range(2 ** (sup + 1), r + 1):
  n = bin(i).count('1') - 1
  ans += 2 ** n
print(ans % int(10**9+7))