program main
    implicit none
    integer x, y, a, b, c
    integer i,j,k
    integer, allocatable, dimension(:) :: p, q, r
    integer, allocatable, dimension(:,:) :: t
    integer temp1, temp2
    integer sum, cx, cy ,random

    read(*,*) x, y, a, b, c
    allocate(p(a))
    allocate(q(b))
    allocate(r(c))
    read(*,*) p
    read(*,*) q
    read(*,*) r
    allocate(t(2,a+b+c))

    t = 0
    do i = 1,a
        t(1,i) = p(i)
        t(2,i) = 1
    end do

    do i = a+1,a+b
        t(1,i) = q(i-a)
        t(2,i) = 2
    end do

    do i = a+b+1,a+b+c
        t(1,i) = r(i-a-b)
        t(2,i) = 3
    end do

    do i = 1, a+b+c-1
        do j = i+1, a+b+c
            if(t(1,i) .gt. t(1,j)) then
                temp1 = t(1,i)
                t(1,i) = t(1,j)
                t(1,j) = temp1

                temp2 = t(2,i)
                t(2,i) = t(2,j)
                t(2,j) = temp2
            end if
        end do
    end do

    sum = 0
    cx = 0
    cy = 0

    do i = a+b+c,1,-1
        if(t(2,i) == 1) then
            if (cx < x) then
                sum = sum + t(1,i)
                cx = cx + 1
            end if
        else if (t(2,i) == 2) then
            if (cy < y) then
                sum = sum + t(1,i)
                cy = cy + 1
            end if
        else if (t(2,i) == 3) then
            random = rand(0)
            if (random < 0.5) then
                if(cx < x) then
                    sum = sum + t(1,i)
                    cx = cx + 1
                else
                    sum = sum + t(1,i)
                    cy = cy + 1
                end if
            else
                if(cy < y) then
                    sum = sum + t(1,i)
                    cy = cy + 1
                else
                    sum = sum + t(1,i)
                    cx = cx + 1
                end if
            end if
        end if

        if(cx == x) then
            if(cy == y) then
                exit
            end if
        end if

    end do

    write(*,*) sum


end program