CodeEff/ECCO huggingface dataset:
# Original solution
import heapq

X,Y,A,B,C = list(map(int,input().split()))
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

a=p[0:X]+q[0:Y]
heapq.heapify(a)

#print(a)
#print(a[0])

flag=True
while flag:
  if len(r)==0:
    flag=False
  elif a[0]<r[0]:
    heapq.heappop(a)
    heapq.heappush(a,r[0])
    r.pop(0)
  else:
    flag=False
print((sum(a)))

# Optimized solution
import heapq

X,Y,A,B,C=list(map(int,input().split()))
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r.sort()

s = p[:X]+q[:Y]
ans=sum(s)
heapq.heapify(s)

while r and s:
    if s[0]<r[-1]:
        ans += r[-1]
        r.pop()
        ans -= heapq.heappop(s)
    else:
        break
print(ans)
# Original solution
from sys import stdin
nii=lambda:list(map(int,stdin.readline().split()))
lnii=lambda:list(map(int,stdin.readline().split()))
from bisect import insort

x,y,a,b,c=nii()
p=lnii()
q=lnii()
r=lnii()

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

l=p[:x]+q[:y]
l.sort()

for i in r:
  insort(l,i)

l.sort(reverse=True)
print((sum(l[:x+y])))

# Optimized solution
from sys import stdin
nii=lambda:list(map(int,stdin.readline().split()))
lnii=lambda:list(map(int,stdin.readline().split()))

x,y,a,b,c=nii()
p=lnii()
q=lnii()
r=lnii()

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

l=p[:x]+q[:y]
l.sort()

ans=0
for i in range(x+y):
  if i<c:
    ans+=max(l[i],r[i])
  else:
    ans+=l[i]

print(ans)
# Original solution
X, Y, A, B, C=list(map(int, input().split()))
p=list(map(int, input().split()))
p.sort()
q=list(map(int, input().split()))
q.sort()
r=list(map(int, input().split()))
r.sort(reverse=True)

i=-X
j=-Y
k=0
deru=0
while deru==0 and k<C and (r[k]>p[i] or r[k]>q[j]):
  if p[i]>q[j] and j<0:
    j+=1
    k+=1
  elif p[i]>q[j] and j>=0 and i<0 and p[i]<r[k]:
    i+=1
    k+=1
  elif p[i]<=q[j] and i<0:
    i+=1
    k+=1
  elif p[i]<=q[j] and i>=0 and j<0 and q[j]<r[k]:
    j+=1
    k+=1
  else:
    deru=1
    
if i==0:
  a=0
else:
  a=sum(p[i:])
  
if j==0:
  b=0
else:
  b=sum(q[j:])
  
if k==0:
  c=0
else:
  c=sum(r[:k])
  
print((a+b+c))

# Optimized solution
X, Y, A, B, C=list(map(int, input().split()))
p=list(map(int, input().split()))
q=list(map(int, input().split()))
r=list(map(int, input().split()))
p.sort()
q.sort()
nums=p[-X:]+q[-Y:]+r
nums.sort()
print((sum(nums[-(X+Y):])))
# Original solution
# coding: utf-8
X,Y,A,B,C=list(map(int,input().split()))
P=list(map(int,input().split()))
Q=list(map(int,input().split()))
R=list(map(int,input().split()))

P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)

EP=P[0:X]
EQ=Q[0:Y]

    # for i in range(X):
    #     EP.append(P[i])
        
    # for i in range(Y):
    #     EQ.append(Q[i])

EP.sort()
EQ.sort()

for i in range(C):
    if R[i]>EP[0] or R[i]>EQ[0]:
        if EP[0]<EQ[0]:
            EP.pop(0)
            EP.append(R[i])
        else:
            EQ.pop(0)
            EQ.append(R[i])
    else:
        break

print((sum(EP)+sum(EQ)))




# Optimized solution
# coding: utf-8
X,Y,A,B,C=list(map(int,input().split()))
P=list(map(int,input().split()))
Q=list(map(int,input().split()))
R=list(map(int,input().split()))

P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)

EP=P[0:X]
EQ=Q[0:Y]

    # for i in range(X):
    #     EP.append(P[i])
        
    # for i in range(Y):
    #     EQ.append(Q[i])

EP.reverse()
EQ.reverse()

ans=sum(EP)+sum(EQ)

p=0
q=0

INF=10**12

EP.append(INF)
EQ.append(INF)

for i in range(C):
    if R[i]>EP[p] or R[i]>EQ[q]:
        if EP[p]<EQ[q]:
            ans+=R[i]
            ans-=EP[p]
            p+=1
        else:
            ans+=R[i]
            ans-=EQ[q]
            q+=1
    else:
        break

print(ans)
# Original solution
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    X, Y, A, B, C = [int(x) for x in input().split()]
    P = [int(x) for x in input().split()]
    Q = [int(x) for x in input().split()]
    R = [int(x) for x in input().split()]

    P.sort(reverse=True)
    Q.sort(reverse=True)
    R.sort(reverse=True)

    xcnt = 0
    ycnt = 0
    rcnt = 0
    ans = 0
    while rcnt < C:
        r = R[rcnt]
        p = float("inf")
        if X - 1 - xcnt >= 0:
            p = P[X - 1 - xcnt]
        q = float("inf")
        if Y - 1 - ycnt >= 0:
            q = Q[Y - 1 - ycnt]
        if p >= r and q >= r:
            break

        if (r - p) > 0 and r - p > r - q:
            xcnt += 1
            rcnt += 1
            ans += r
        elif (r - q) > 0 and r - q > r - p:
            ycnt += 1
            rcnt += 1
            ans += r
    ans += sum(P[:X - xcnt])
    ans += sum(Q[:Y - ycnt])

    print(ans)


if __name__ == '__main__':
    main()



# Optimized solution
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    X, Y, A, B, C = [int(x) for x in input().split()]
    P = [int(x) for x in input().split()]
    Q = [int(x) for x in input().split()]
    R = [int(x) for x in input().split()]

    P.sort(reverse=True)
    Q.sort(reverse=True)
    R.sort(reverse=True)

    xcnt = 0
    ycnt = 0
    rcnt = 0
    ans = 0

    for r in R:
        p = float("inf")
        if X - 1 - xcnt >= 0:
            p = P[X - 1 - xcnt]
        q = float("inf")
        if Y - 1 - ycnt >= 0:
            q = Q[Y - 1 - ycnt]
        if p >= r and q >= r:
            break

        if (r - p) > 0 and r - p > r - q:
            xcnt += 1
            rcnt += 1
            ans += r
        else:
            ycnt += 1
            rcnt += 1
            ans += r

    ans += sum(P[:X - xcnt])
    ans += sum(Q[:Y - ycnt])

    print(ans)


if __name__ == '__main__':
    main()
# Original solution
X,Y,A,B,C = (int(x) for x in input().split())
red = list(map(int, input().strip().split()))
green = list(map(int, input().strip().split()))
clear = list(map(int, input().strip().split()))
red.sort(reverse=True)
green.sort(reverse=True)
clear.sort(reverse=True)
pre_answer = 0
answer = 0
for i in range (max(X+Y,C)):
    for k in range (i+1):
        if(X-k>=0 and Y-(i-k)>=0 ):
            pre_answer = sum(red[0:X-k]) + sum(green[0:Y-(i-k)]) + sum(clear[0:i])
#             print(X-k,Y-(i-k),i,pre_answer)
            if(answer<pre_answer):
                answer = pre_answer
print(answer)

# Optimized solution
X,Y,A,B,C = (int(x) for x in input().split())
red = list(map(int, input().strip().split()))
green = list(map(int, input().strip().split()))
clear = list(map(int, input().strip().split()))
red.sort(reverse=True)
green.sort(reverse=True)
# clear.sort(reverse=True)
apple = red[0:X] + green[0:Y] + clear
apple.sort(reverse=True)
print((sum(apple[0:X+Y])))
# Original solution
X,Y,A,B,C=list(map(int,input().split()))
ls_a=sorted(list(map(int,input().split())))
ls_b=sorted(list(map(int,input().split())))
ls_c=sorted(list(map(int,input().split())))
ls_x=ls_a[A-X:A]
ls_y=ls_b[B-Y:B]
ls_c.reverse()

ans=sum(ls_x)+sum(ls_y)
a=b=c=0
for _ in range(min([X+Y,C])):
  if a==len(ls_x):
    m=min([ls_y[b],ls_c[c]])
    if m==ls_y[b]:
      ans+=(-ls_y[b]+ls_c[c])
      b+=1
      c+=1
    else:
      break
  elif b==len(ls_y):
    m=min([ls_x[a],ls_c[c]])
    if m==ls_x[a]:
      ans+=(-ls_x[a]+ls_c[c])
      a+=1
      c+=1
    else:
      break
  else:    
    m=min([ls_x[a],ls_y[b],ls_c[c]])
    if m==ls_x[a]:
      ans+=(-ls_x[a]+ls_c[c])
      a+=1
      c+=1
    elif m==ls_y[b]:
      ans+=(-ls_y[b]+ls_c[c])
      b+=1
      c+=1
    else:
      break
print(ans)

# Optimized solution
X,Y,A,B,C=list(map(int,input().split()))
ls_a=list(map(int,input().split()))
ls_b=list(map(int,input().split()))
ls_c=list(map(int,input().split()))

ls_a.sort(reverse=True)
ls_b.sort(reverse=True)
ls_c.sort(reverse=True)

ls=sorted(ls_a[:X]+ls_b[:Y])
ans=sum(ls)
for i in range(min(X+Y, C)):
    if ls[i] < ls_c[i]:
        ans += ls_c[i] - ls[i]
print(ans)
# Original solution
from heapq import heapify, heappop, heappush, heappushpop
import sys
input = sys.stdin.readline
x,y,a,b,c=list(map(int, input().split()))
p=list(map(int, input().split()))
q=list(map(int, input().split()))
r=list(map(int, input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r.sort()
p=p[:x]
q=q[:y]
heapify(p)
heapify(q)
mp = heappop(p)
mq = heappop(q)
for ri in r:
  if mp<mq:
    if mp<ri:
      heappush(p, ri)
      mp=heappop(p)
  else:
    if mq<ri:
      heappush(q, ri)
      mq=heappop(q)

print((sum(p)+sum(q)+mp+mq))

# Optimized solution
import sys
input = sys.stdin.readline
x,y,a,b,c=list(map(int, input().split()))
p=list(map(int, input().split()))
q=list(map(int, input().split()))
r=list(map(int, input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
p=p[:x]
q=q[:y]
r=r+p+q
r.sort(reverse=True)
print((sum(r[:x+y])))
# Original solution
X,Y,A,B,C = list(map(int, input().split()))
As = sorted(list(map(int, input().split())), reverse=True)
Bs = sorted(list(map(int, input().split())), reverse=True)
Cs = sorted(list(map(int, input().split())), reverse=True)

s = 0
_C = 0
while A+B+C > 0:
  if X+Y == _C:
    break
  if X+Y == 0:
    break
  mx = 0
  mxi = None
  for i, v in enumerate([As[0] if A>0 and X>0 else 0, Bs[0] if B>0 and Y>0 else 0, Cs[0] if C>0 else 0]):
    if v > mx:
      mx = v
      mxi = i
  if mxi == 0:
    A -= 1
    X -= 1
    As = As[1:] if len(As) > 1 else []
  elif mxi == 1:
    B -= 1
    Y -= 1
    Bs = Bs[1:] if len(Bs) > 1 else []
  elif mxi == 2:
    C -= 1
    _C += 1
    Cs = Cs[1:] if len(Cs) > 1 else []
  s += mx

print(s)


# Optimized solution
X,Y,A,B,C = list(map(int, input().split()))
As = sorted(list(map(int, input().split())), reverse=True)
Bs = sorted(list(map(int, input().split())), reverse=True)
Cs = list(map(int, input().split()))

As = As[:X]
Bs = Bs[:Y]
ans = 0
Xs = sorted(As+Bs+Cs, reverse=True)
print((sum(Xs[:X+Y])))
# Original solution
f=lambda:list(map(int,input().split()))
x,y,a,b,c=f()
p=sorted(f())[::-1]
q=sorted(f())[::-1]
r=sorted(f())[::-1]
lp,lq,lr=[0]*(a+1),[0]*(b+1),[0]*(c+1)
s=t=u=m=0
for i in range(a): s+=p[i]; lp[i+1]+=s
for i in range(b): t+=q[i]; lq[i+1]+=t
for i in range(c): u+=r[i]; lr[i+1]+=u
for i in range(min(x,c)+1):
  for j in range(min(y,c-i)+1):
    m=max(m,lp[x-i]+lq[y-j]+lr[i+j])
print(m)

# Optimized solution
f=lambda:list(map(int,input().split()))
x,y,a,b,c=f()
l=sorted(sorted(f())[-x:]+sorted(f())[-y:]+list(f()))
print((sum(l[-x-y:])))
# Original solution
X, Y, A, B, C = list(map(int, input().split()))

pList = list(map(int, input().split()))
qList = list(map(int, input().split()))
rList = list(map(int, input().split()))

pList.sort(reverse=True)
qList.sort(reverse=True)
rList.sort(reverse=True)

pList = pList[:X]
qList = qList[:Y]

value = 0

for indx in range(X+Y):
    if (pList[0] >= qList[0]) and (pList[0] >= rList[0]):
        value += pList[0]
        pList.pop(0)

        if len(pList) == 0:
            pList.append(-1)

    elif (qList[0] > pList[0]) and (qList[0] > rList[0]):
        value += qList[0]
        qList.pop(0)

        if len(qList) == 0:
            qList.append(-1)

    else:
        value += rList[0]
        rList.pop(0)

        if len(rList) == 0:
            rList.append(-1)


print(value)


# Optimized solution
X, Y, A, B, C = list(map(int, input().split()))

pList = list(map(int, input().split()))
qList = list(map(int, input().split()))
rList = list(map(int, input().split()))

pList.sort(reverse=True)
qList.sort(reverse=True)
rList.sort(reverse=True)

pList = pList[:X]
qList = qList[:Y]

appleList = pList + qList + rList
appleList.sort(reverse=True)
appleList = appleList[:X+Y]

print((sum(appleList)))
# Original solution
import heapq

x,y,a,b,c=list(map(int,input().split()))
arr1=list(map(int,input().split()))
arr2=list(map(int,input().split()))
arr3=list(map(int,input().split()))
q=[]
for val in arr1:
  heapq.heappush(q,(-val,1))
for val in arr2:
  heapq.heappush(q,(-val,2))
for val in arr3:
  heapq.heappush(q,(-val,3))
ans=0
cnt1=0
cnt2=0
cnt3=0
while cnt1+cnt2+cnt3<x+y:
  tmp,flag=heapq.heappop(q)
  tmp*=-1
  if flag==1:
    if cnt1<x:
      ans+=tmp
      cnt1+=1
  elif flag==2:
    if cnt2<y:
      ans+=tmp
      cnt2+=1
  elif flag==3:
    ans+=tmp
    cnt3+=1
print(ans)

# Optimized solution
x,y,a,b,c=list(map(int,input().split()))
arr1=list(map(int,input().split()))
arr1=sorted(arr1,reverse=True)
arr1=arr1[:x]
arr2=list(map(int,input().split()))
arr2=sorted(arr2,reverse=True)
arr2=arr2[:y]
arr3=list(map(int,input().split()))
ans=arr1+arr2+arr3
ans=sorted(ans,reverse=True)
print((sum(ans[:x+y])))
# Original solution
import heapq

x,y,a,b,c = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p = sorted(p, reverse = True)[:x]
q = sorted(q, reverse = True)[:y]
r = sorted(r, reverse = True)

for i in range(min(x+y, len(r))):
  if min(p) >= min(q) and r[0] > min(q):
    heapq.heapify(q)
    heapq.heappop(q)
    q.append(r[0])
    r.pop(0)
  elif min(q) >= min(p) and r[0] > min(p):
    heapq.heapify(p)
    heapq.heappop(p)
    p.append(r[0])
    r.pop(0)

print((sum(p) + sum(q)))

# Optimized solution
import heapq

x,y,a,b,c = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p = sorted(p, reverse = True)[:x]
q = sorted(q, reverse = True)[:y]
r = sorted(r, reverse = True)

pqr = p + q + r
pqr = sorted(pqr, reverse = True)[:x+y]

print((sum(pqr)))
# Original solution
X,Y,A,B,C=list(map(int,input().split()))
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
x=0
y=0
z=0
s=0
while (x<X or y<Y) and z<X+Y:
  if (max(p[0],q[0],r[0])==p[0] or (y==Y and r[0]<p[0])) and x<X:
    s+=p[0]
    p.remove(p[0])
    p.append(0)
    x+=1
    z+=1
  elif (max(p[0],q[0],r[0])==q[0] or (x==X and r[0]<q[0])) and y<Y:
    s+=q[0]
    q.remove(q[0])
    q.append(0)
    y+=1
    z+=1
  else:
    s+=r[0]
    r.remove(r[0])
    r.append(0)
    z+=1
print(s)

# Optimized solution
X,Y,A,B,C=list(map(int,input().split()))
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
x=0
y=0
R=0
z=0
s=0
while (x<X or y<Y) and z<X+Y:
  if (max(p[0],q[0],r[0])==p[0] or (y==Y and r[0]<p[0])) and x<X:
    s+=p[0]
    x+=1
    if x<A:
      p[0]=p[x]
    else:
      p[0]=0
    z+=1
  elif (max(p[0],q[0],r[0])==q[0] or (x==X and r[0]<q[0])) and y<Y:
    s+=q[0]
    y+=1
    if y<B:
      q[0]=q[y]
    else:
      q[0]=0
    z+=1
  else:
    s+=r[0]
    R+=1
    if R<C:
      r[0]=r[R]
    else:
      r[0]=0
    z+=1
print(s)
# Original solution
import heapq
x,y,a,b,c=list(map(int,input().split()))
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
p=p[:x]
q=q[:y]
heapq.heapify(p)
heapq.heapify(q)
for i in range(c):
  pp=heapq.heappop(p)
  pq=heapq.heappop(q)
  if pp<r[i] and pq>=r[i]:
    heapq.heappush(p,r[i])
    heapq.heappush(q,pq)
  elif pp>=r[i] and pq<r[i]:
    heapq.heappush(q,r[i])
    heapq.heappush(p,pp)
  elif pp<r[i] and pq<r[i]:
    if r[i]-pp>=r[i]-pq:
      heapq.heappush(p,r[i])
      heapq.heappush(q,pq)
    else:
      heapq.heappush(q,r[i])
      heapq.heappush(p,pp)
  else:
    heapq.heappush(q,pq)
    heapq.heappush(p,pp)
print((sum(p)+sum(q)))

# Optimized solution
x,y,a,b,c=list(map(int,input().split()))
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
lis=p[:x]+q[:y]+r
lis.sort(reverse=True)
ans=0
for i in range(x+y):
  ans+=lis[i]
print(ans)
# Original solution
X,Y,A,B,C=list(map(int,input().split()))
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

tot=sum(p[:X])+sum(q[:Y])

a=0
b=0
for i in r:
    if a==X and b==Y:
        break
    elif a==X:
        if i>q[Y-b-1]:
            tot+=i-q[Y-b-1]
            b+=1
        else:
            break
    elif b==Y:
        if i>p[X-a-1]:
            tot+=i-p[X-a-1]
            a+=1
        else:
            break
    else:
        if i>p[X-a-1] and i>q[Y-b-1]:
            if p[X-a-1]<q[Y-b-1]:
                tot+=i-p[X-a-1]
                a+=1
            else:
                tot+=i-q[Y-b-1]
                b+=1
        elif i>p[X-a-1]:
            tot+=i-p[X-a-1]
            a+=1
        elif i>q[Y-b-1]:
            tot+=i-q[Y-b-1]
            b+=1
        else:
            break

print(tot)




# Optimized solution
X,Y,A,B,C=list(map(int,input().split()))
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))

p.sort(reverse=True)
q.sort(reverse=True)

p=p[:X]
q=q[:Y]

z=p+q+r

z.sort(reverse=True)

tot=sum(z[:X+Y])

print(tot)
# Original solution
# coding: utf-8
# Your code here!

x,y,a,b,c = list(map(int,input().split()))
p_a = list(map(int,input().split()))
p_b = list(map(int,input().split()))
p_c = list(map(int,input().split()))
p_a.sort(reverse=True)
p_b.sort(reverse=True)
p_c.sort(reverse=True)
p_c += [0]

ans = p_a[:x] + p_b[:y]
ans.sort(reverse=True)

while True:
    if ans[-1] > p_c[0]:
        break
    else:
        ans[-1] = p_c[0]
        p_c.pop(0)
        ans.sort(reverse=True)
print((sum(ans)))

# Optimized solution
x,y,a,b,c = list(map(int,input().split()))
p_a = list(map(int,input().split()))
p_b = list(map(int,input().split()))
p_c = list(map(int,input().split()))
p_a.sort(reverse=True)
p_b.sort(reverse=True)
#p_c.sort(reverse=True)

ans = p_a[:x] + p_b[:y] + p_c
ans.sort(reverse=True)
print((sum(ans[:x+y])))
# Original solution
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

x, y, a, b, c = LI()
p = LI()
q = LI()
r = LI()

p.sort(reverse=1)
q.sort(reverse=1)
r.sort(reverse=1)
r = list(accumulate(r))
ans = 0
h = []
s = sum(p[:x])
s += sum(q[:y])
for i in p[:x]:
    heappush(h, i)
for i in q[:y]:
    heappush(h, i)
ans = s
for i in range(c):
    if len(h) > 0:
        f = heappop(h)
    else:
        break
    s -= f
    tmp = s + r[i]
    ans = max(ans, tmp)
print(ans)


# Optimized solution
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

x, y, a, b, c = LI()
p = LI()
q = LI()
r = LI()

p.sort(reverse=1)
q.sort(reverse=1)
A = p[:x] + q[:y] + r
A.sort(reverse=1)
print((sum(A[:x+y])))
# Original solution
X, Y, A, B, C = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

eat = []

# 食べる
p.sort(reverse=True)
if X > A:
    eat.extend(p)
else:
    eat.extend(p[:X])

q.sort(reverse=True)
if Y > B:
    eat.extend(q)
else:
    eat.extend(q[:Y])
loss = X+Y - len(eat)

# 足りない分を補充する
while loss > 0:
    r.sort(reverse=True)
    eat.append(r.pop(0))    
    loss -= 1

# rの方が大きいものがあれば入れ替える
eat.sort()
for i in range(len(eat)):
    r.sort(reverse=True)
    if len(r) != 0 and eat[i] < r[0]:
        eat[i] = r.pop(0)
    else:
        break

print((sum(eat)))

# Optimized solution
X, Y, A, B, C = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

eat = []

# 食べる
p.sort(reverse=True)
if X > A:
    eat.extend(p)
else:
    eat.extend(p[:X])

q.sort(reverse=True)
if Y > B:
    eat.extend(q)
else:
    eat.extend(q[:Y])
loss = X+Y - len(eat)

# 足りない分を補充する
while loss > 0:
    r.sort(reverse=True)
    eat.append(r.pop(0))    
    loss -= 1

# rの方が大きいものがあれば入れ替える
eat.sort()
r.sort()
for i in range(len(eat)):
    if len(r) != 0 and eat[i] < r[-1]:
        eat[i] = r.pop(-1)
    else:
        break

print((sum(eat)))
# Original solution
x,y,a,b,c=list(map(int,input().split()))
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
A.sort(reverse=True)
A.sort()
B.sort()
C.sort(reverse=True)
A=A[a-x:]
B=B[b-y:]

i=0
j=0
k=0
lea=len(A)
leb=len(B)
while(True):
    if len(C)<1:
        break
    if i<lea and j<leb:
        if A[i]>B[j]:
            if B[j]<C[0]:
                B[j]=C.pop(0)
                
                j+=1
            else:
                break
        else:
            if A[i]<C[0]:
                A[i]=C.pop(0)
                i+=1
            else:
                break
    elif i<lea and j>=leb:
        if A[i]<C[0]:
                A[i]=C.pop(0)
                i+=1
        else:
            break
    elif i>=lea and j<leb:
        if B[j]<C[0]:
                B[j]=C.pop(0)
                j+=1
        else:
            break
    else:
        break
sum=0


for s in range(len(A)):
    sum+=A[s]
for t in range(len(B)):
    sum+=B[t]
print(sum)
            



# Optimized solution
x,y,a,b,c=list(map(int,input().split()))
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
A.sort(reverse=True)
A.sort()
B.sort()
A=A[a-x:]
B=B[b-y:]
D=A+B+C
D.sort(reverse=True)
sum=0
for i in range(x+y):
    sum+=D[i]
print(sum)
# Original solution
x,y,a,b,c=list(map(int,input().split()))
r=sorted(list(map(int,input().split())),reverse=True)
g=sorted(list(map(int,input().split())),reverse=True)
w=sorted(list(map(int,input().split())),reverse=True)

p=sorted(r[:x]+g[:y],reverse=True)

i=0
ans=0
while i<x+y:
    if w==[] or p[0]>w[0]: 
        ans+=p.pop(0)
    else: 
        ans+=w.pop(0)
    i+=1
print(ans)

# Optimized solution
x,y,a,b,c=list(map(int,input().split()))
r=sorted(list(map(int,input().split())),reverse=True)
g=sorted(list(map(int,input().split())),reverse=True)
w=list(map(int,input().split()))

p=sorted(r[:x]+g[:y]+w,reverse=True)
print((sum(p[:x+y])))
# Original solution
#!/usr/bin/python3
# -*- coding:utf-8 -*-

def main():
  x, y, a, b, c = list(map(int, input().split()))
  la = list(map(int, input().split()))
  la.sort(reverse=True)
  lb = list(map(int, input().split()))
  lb.sort(reverse=True)
  lc = list(map(int, input().split()))
  lc.sort(reverse=True)
  ca, cb, cc = 0, 0, 0,
  
  s = 0
  while True:
    if sum([ca, cb, cc]) == x+y:
      break
      
    a = la[0] if len(la) > 0 and ca < x else -1
    b = lb[0] if len(lb) > 0 and cb < y else -1
    c = lc[0] if len(lc) > 0            else -1
            
    if a >= b and a >= c:
      s += a
      la.pop(0)
      ca += 1
      continue
      
    if b >= a and b >= c:
      s += b
      lb.pop(0)
      cb += 1
      continue
      
    if c >= b and c >= a:
      s += c
      lc.pop(0)
      cc += 1
  print(s)

if __name__=='__main__':
  main()



# Optimized solution
#!/usr/bin/python3
# -*- coding:utf-8 -*-


def main():
  x, y, na, nb, nc = list(map(int, input().split()))
  la = list(map(int, input().split()))
  la.sort(reverse=True)
  lb = list(map(int, input().split()))
  lb.sort(reverse=True)
  lc = list(map(int, input().split()))
  lc.sort(reverse=True)
  ca, cb, cc = 0, 0, 0
  
  lx = la[:x] + lb[:y] + lc
  lx.sort(reverse=True)
  print((sum(lx[:x+y])))

if __name__=='__main__':
  main()