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

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