L, R = gets.split.map(&:to_i)

# (L..R).each do |x|
#   (x..R).each do |y|
#     puts "#{"%#b" % y} % #{"%#b" % x} = #{y % x}, #{"%#b" % y} ^ #{"%#b" % x} = #{y ^ x}" if (y % x) == (y ^ x)
#   end
# end

# 二進でn桁：3**(n-1)個
sum = 0
(L.bit_length..R.bit_length).each do |n|
  sum += 3 ** (n-1)
end
(2**L.bit_length...L).each do |i|
  i.bit_length.times do |j|
    sum -= 2 if i[j] == 0
  end
end
(2**(R.bit_length+1)..R).each do |i|
  i.bit_length.times do |j|
    sum += 2 if i[j] == 0
  end
end
puts sum % (10**9+7)
