program coincidence
  implicit none
  integer(8), parameter :: md = 1000000007_8
  integer(8) :: l, r, dp(0:60,0:1,0:1,0:1) = 0_8
  integer :: i, j, k, s, lb, rb, x, y, jj, kk, ss
  read(*,*) l, r
  dp(60,0,0,0) = 1_8
  do i = 59, 0, -1
    lb = 0
    rb = 0
    if (btest(l,i)) lb = 1
    if (btest(r,i)) rb = 1
    do j = 0, 1
      do k = 0, 1
        do s = 0, 1
          do x = 0, 1
            do y = 0, 1
              if (x-y == 1) cycle
              jj = j
              kk = k
              ss = s
              if (s == 0 .and. x /= y) cycle
              if (x*y == 1) ss = 1
              if (lb-j-x == 1) cycle
              if (x-lb == 1) jj = 1
              if (y-k-rb == 1) cycle
              if (rb-y == 1) kk = 1
              dp(i,jj,kk,ss) = mod(dp(i,jj,kk,ss)+dp(i+1,j,k,s),md)
            end do
          end do
        end do
      end do
    end do
  end do
  write(*,'(i0)') mod(sum(dp(0,:,:,:)),md)
end program coincidence