def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

l,r = inp
dp = Array.new(60){Array.new(2){Array.new(2){Array.new(2,0)}}}
ls = l.to_s(2)
rs = r.to_s(2)
ls = "0"*100 + ls
rs = "0"*100 + rs
ls.reverse!
rs.reverse!
dp[59][0][0][0] = 1
ans = na3(2,2,2,0)
(0..59).to_a.reverse.each do |keta|
  2.times do |i|
    2.times do |j|
      2.times do |k|
        now = dp[keta][i][j][k]
        next if(now == 0)
        2.times do |x|
          2.times do |y|
            next if(y<x)
            nx=i
            ny=j
            nb=k
            next if(k==0 and x!=y)
            next if(j==0 and x==0 and ls[keta].to_i == 1)
            next if(k==0 and y==1 and rs[keta].to_i == 0)
            nb = 1 if(x == y and x == 1)
            ny = 1 if(y < rs[keta].to_i)
            nx = 1 if(ls[keta].to_i < x)
            if(keta == 0)
              ans[nx][ny][nb] += now
            else
              dp[keta-1][nx][ny][nb] += now
              dp[keta-1][nx][ny][nb] %= (10**9+7)
            end
          end
        end
      end
    end
  end

end
p ans.flatten.inject{|m,u|(m+u)%(10**9+7)}