L,R = map(int,input().split())
count = 0
for x in range(L,R+1,1):
  for y in range(L,R+1,1):
    surplus = y % x
    xor_xy = bin(x ^ y)
    xor_10 = int(xor_xy,2)
    if (surplus == xor_10):
      count += 1
result = count % (10 ** 9 + 7)
print(result)