l,r = gets.split.map(&:to_i)
mod = 10**9+7
ans, lb, rb = 0, l.bit_length, r.bit_length

if rb > lb
	(l...2**lb).each do |x|
		ans += (2**x.to_s(2).count("0") % mod)
	end
	
	((lb+1)...rb).each do |xb|
		ans += (3**(xb-1)%mod)
	end
	ones=r.to_s(2).reverse.each_char.with_index.map { |a, i| a == '1' ? i : nil }.compact.reverse
	ones.shift
	ones.push(0)
	i = 0
	ones.each do |one|
		ans+= ((3**one) * (2**i)) % mod
		i += 1
	end
else
	(([2**(rb-1),l].max)..r).each do |x|
		(x..r).each do |y|
			ans += 1 if (y-x)==(y^x)
		end
	end
end
p ans%mod