program main
      implicit none
      integer(4) :: x, y, a, b, c
      integer(4), allocatable :: p(:), q(:), r(:)
      integer(4), allocatable :: pr(:), qr(:)
      integer(4) :: i, red, grn, key, total

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

      allocate( pr(a+c) )
      pr(1:a) = p(:)
      pr(a+1:a+c) = r(:)
      deallocate( p )
     
      total = 0 
      do i = 1, x
        red = maxval( pr )
        key = maxloc( pr,1 )
        pr( key ) = 0
        total = total + red
        if ( key > a ) then
          r( key - a ) = 0
        end if
      end do
      deallocate( pr )

      allocate( qr(b+c) )
      qr(1:b) = q(:)
      qr(b+1:b+c) = r(:)
      deallocate( q )
      deallocate( r )

      do i = 1, y
        grn = maxval( qr )
        key = maxloc( qr,1 )
        qr( key ) = 0
        total = total + grn
      end do
      deallocate( qr )

      print *, total

end program main 
