CodeEff/ECCO huggingface dataset:
# Original solution
import heapq

x, y, a, b, c = list(map(int, input().split()))
pp = list([(-int(x), 1) for x in input().split()])
qq = list([(-int(x), 2) for x in input().split()])
rr = list([(-int(x), 3) for x in input().split()])

xx = pp + qq + rr
heapq.heapify(xx)
t = x + y
ans = 0
for _ in range(t):
    while len(xx) > 0:
        v = heapq.heappop(xx)
        if v[1] == 1 and x <= 0:
            continue
        if v[1] == 2 and y <= 0:
            continue
        break

    if v[1] == 1:
        x -= 1
    if v[1] == 2:
        y -= 1
    ans += v[0]

print((-ans))


# Optimized solution
x, y, a, b, c = list(map(int, input().split()))
pp = list(sorted(map(int, input().split()), reverse=True))[:x]
qq = list(sorted(map(int, input().split()), reverse=True))[:y]
rr = list(map(int, input().split()))

xx = list(sorted(pp + qq + rr, reverse=True))[:x+y]
print((sum(xx)))
# Original solution
import heapq

X, Y, A, B, C= list(map(int, input().split()))
P = list(map(int, input().split()))
P.sort(reverse=True)
P = P[:X]
Q = list(map(int, input().split()))
Q.sort(reverse=True)
Q = Q[:Y]
R = list(map(int, input().split()))
R.sort(reverse=True)
colored = []
for r in R:
    p_min = P[-1]
    q_min = Q[-1]
    if p_min <= q_min and p_min < r:
        P.pop()
        P.insert(0, r)
    elif q_min <= p_min and q_min < r:
        Q.pop()
        Q.insert(0, r)
    else:
        break
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()))
P.sort(reverse=True)
P = P[:X]
heapq.heapify(P)
Q = list(map(int, input().split()))
Q.sort(reverse=True)
Q = Q[:Y]
heapq.heapify(Q)
R = list(map(int, input().split()))
R.sort(reverse=True)
for r in R:
    p_min = P[0]
    q_min = Q[0]
    if p_min <= q_min and p_min < r:
        heapq.heapreplace(P, r)
    elif q_min <= p_min and q_min < r:
        heapq.heapreplace(Q, r)
    else:
        break
print((sum(P) + sum(Q)))
# Original solution
X,Y,A,B,C = list(map(int, input().split()))
P=sorted(list(map(int,input().split())), reverse=True)
Q=sorted(list(map(int,input().split())), reverse=True)
R=sorted(list(map(int,input().split())), reverse=True)

a=[0]
b=[0]
c=[0]

for i in P[:X]:
    a.append(a[-1]+i)
    
for i in Q[:Y]:
    b.append(b[-1]+i)
      
for i in R:
    c.append(c[-1]+i)
    
ans={0}

for i in range(len(c)):
    for j in range(len(b)):
        for k in range(len(a)):
            if i+j+k==X+Y:
                tmp=c[i]+b[j]+a[k]
                #print(tmp)
                ans.add(tmp)
            else:
                pass
            
print((max(ans)))

# Optimized solution
X,Y,A,B,C = list(map(int, input().split()))
P=sorted(list(map(int,input().split())), reverse=True)
Q=sorted(list(map(int,input().split())), reverse=True)
R=sorted(list(map(int,input().split())), reverse=True)

C = P[:X] + Q[:Y] + R
C.sort(reverse=True)

print((sum(C[:X+Y])))
# Original solution
import sys
input = sys.stdin.buffer.readline
import heapq

def main():
    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()
    r.sort()
    p = p[-X:]
    q = q[-Y:]
    r = r[-X-Y:]
    use = p+q
    heapq.heapify(use)
    heapq.heapify(r)
    while len(r)>0:
        unt = heapq.heappop(use)
        nc = heapq.heappop(r)
        if nc > unt:
            heapq.heappush(use,nc)
        else:
            heapq.heappush(use,unt)

    print((sum(use)))
    
if __name__ == "__main__":
    main()


# Optimized solution
import sys
input = sys.stdin.buffer.readline

def main():
    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()
    r.sort()
    p = p[-X:]
    q = q[-Y:]
    use = p+q+r
    use.sort(reverse=True)
    print((sum(use[:X+Y])))

if __name__ == "__main__":
    main()
# Original solution
X,Y,A,B,C = [int(i) for i in input().split()]

def input_list(N):
  list = []
  for i in input().split():
    list.append(int(i))
  list.sort(reverse=True)
  return list

P = input_list(A)
Q = input_list(B)
R = input_list(C)

def delete_last(list,X):
  for i in range(X,len(list)):
    list.pop(X)

delete_last(P,X)
delete_last(Q,Y)


Top = P + Q + R
Top.sort(reverse=True)
sum = 0
for i in range(X+Y):
  sum += Top[i]
print(sum)


# Optimized solution
X,Y,A,B,C = [int(i) for i in input().split()]

def input_list(N):
  list = []
  for i in input().split():
    list.append(int(i))
  list.sort(reverse=True)
  return list

P = input_list(A)
Q = input_list(B)
R = input_list(C)
Top = P[:X] + Q[:Y] + R
Top.sort(reverse=True)
sum = 0
for i in range(X+Y):
  sum += Top[i]
print(sum)
# Original solution
import sys

input = sys.stdin.readline
x,y,a,b,c = list(map(int,input().split()))

pl = list(map(int,input().split()))
ql = list(map(int,input().split()))
rl = list(map(int,input().split()))

pl = sorted(pl)
ql = sorted(ql)
rl = sorted(rl)
import itertools
pl_ac = [0] + list(itertools.accumulate(pl))
ql_ac = [0] + list(itertools.accumulate(ql))
rl_ac = [0] + list(itertools.accumulate(rl))

dada = max(ql[-1], pl[-1], rl[-1])

import bisect
ans = 0
#　赤色をi個食べるとすると無職x-i
for i in range(x+1):
    tmp = 0
    if i > a or x - i > c or b + c - (x - i) < y:
        continue
    #あか
    tmp += pl_ac[-1] - pl_ac[-1-i]
    # #無職
    # tmp += rl_ac[-1] - ql_ac[-1-(x-i)]
    #残りの無職
    if x-i == 0:
        rl_c = rl[:]
    else:
        rl_c = rl[:-(x-i)]
    # ub以上のりんご何個ある？
    ub = dada + 1

    lb = -1
    while True:
        if ub == lb:
            target = ub
            break
        target = (ub + lb) // 2 + 1
        idx = bisect.bisect_left(ql, target)
        idx2 = bisect.bisect_left(rl_c, target)
        if (b - idx) + (c - (x - i) - idx2) >= y:
            lb = target
        else:
            ub = target - 1
    idx = bisect.bisect_left(ql, target)
    idx2 = bisect.bisect_left(rl_c, target)
    tmp += ql_ac[-1] - ql_ac[idx]
    tmp += rl_ac[-1] - rl_ac[idx2]
    gg = (b - idx) + (c - (x - i) - idx2) - y
    if gg > 0:
        tmp -= target * gg
    ans = max(tmp, ans)

print(ans)

# Optimized solution
x,y,a,b,c = list(map(int,input().split()))
pl = list(map(int,input().split()))
ql = list(map(int,input().split()))
rl = list(map(int,input().split()))

pl = sorted(pl)
ql = sorted(ql)
rl = sorted(rl)
ansl = pl[-x:] + ql[-y:]

ansl += rl

ansl = sorted(ansl)
print((sum(ansl[-(x+y):])))
# Original solution
X, Y, A, B, C = list(map(int, input().split()))
Ap = list([(int(x), 0) for x in input().split()])
Bq = list([(int(x), 1) for x in input().split()])
Cr = list([(int(x), 2) for x in input().split()])

INF = 2 * 10**5 + 1

L = Ap + Bq + Cr
L.sort(reverse = True)

cnt = [0, 0, 0]
cntM = [X, Y, INF]
s = 0

ans = 0

for x, i in L:
  if s == X + Y:
    break
  elif cnt[i] < cntM[i]:
    ans += x
    cnt[i] += 1
    s += 1
  else:
    pass

print(ans)

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

Ap.sort(reverse = True)
Bq.sort(reverse = True)

L = sorted(Ap[:X] + Bq[:Y] + Cr, reverse = True)

print((sum(L[:X+Y])))
# Original solution
x, y, a, b, c = list(map(int, input().split()))
arrayP = list(map(int, input().split()))
arrayQ = list(map(int, input().split()))
arrayR = list(map(int, input().split()))
arrayP.sort(reverse=True)
arrayQ.sort(reverse=True)
arrayR.sort(reverse=True)
arrayAns = []
for i in range(x):
    arrayAns.append(int(arrayP[i]))
for i in range(y):
    arrayAns.append(int(arrayQ[i]))
arrayAns.sort()
for i in range(min(len(arrayR), len(arrayAns))):
    if arrayAns[i] <= int(arrayR[i]):
        arrayAns[i] = int(arrayR[i])
    else:
        break
print((sum(arrayAns)))

# 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)

hoge=p[:X]+q[:Y]+r
hoge.sort(reverse=True)
print((sum(hoge[:X+Y])))
# Original solution
x, y, a, b, c = list(map(int, input().split()))
p = sorted(list(map(int, input().split())),reverse = True)
q = sorted(list(map(int, input().split())),reverse = True)
r = sorted(list(map(int, input().split())),reverse = True)


ans = 0

while (p[0] > r[0]):
    ans += p.pop(0)
    x -= 1
    if (x == 0):
        break
while (q[0] > r[0]):
    ans += q.pop(0)
    y-=1
    if (y == 0):
        break

if (x == 0 and y == 0):
    print(ans)
else:
    aps = sorted(p[0: x] + q[0: y] + r[0: x + y], reverse=True)
    #print(aps)
    print((ans+sum(aps[0:x+y])))



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

px = p[:x]
qx = q[:y]

aps = sorted(px + qx + r, reverse=True)

print((sum(aps[0:x+y])))
# Original solution
#n,x,y=map(int,input())
# Queue

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()
p=p[a-x:]
q=q[b-y:]
r.sort()
for ri in r:
    if ri > p[0] and q[0] >= p[0]:
        p[0] = ri
        p.sort()
        continue
    if ri > q[0] and p[0] >= q[0]:
        q[0]=ri
        q.sort()
print((sum(p)+sum(q)))

"""
1 2 2 2 1
2 4
5 1
3
->12
2 2 2 2 2
8 6
9 1
2 1
->25
"""



# 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]
p[x:x]=q
p[x+y:x+y]=r
p.sort(reverse=True)
p=p[:x+y]
print((sum(p)))
# Original solution
x,y,a,b,c=list(map(int,input().split()))
p=list([['red',int(x)] for x in input().split()])
q=list([['green',int(x)] for x in input().split()])
r=list([['nan',int(x)] for x in input().split()])
p.sort(key=lambda x:x[1])
p=p[-x:]
q.sort(key=lambda x:x[1])
q=q[-y:]
p[len(p):len(p)]=q
p[len(p):len(p)]=r
p.sort(key=lambda x:x[1])
p=p[-x-y:]
print((sum([pi[1] for pi in p])))
  


# 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()
p=p[-x:]
q.sort()
q=q[-y:]
p[len(p):len(p)]=q
p[len(p):len(p)]=r
p.sort()
p=p[-x-y:]
print((sum(p)))
# 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()
p=p[-x:]
q.sort()
q=q[-y:]
p[len(p):len(p)]=q
p[len(p):len(p)]=r
p.sort()
p=p[-x-y:]
print((sum(p)))

# Optimized solution
x,y,nr,ng,nm=list(map(int,input().split()))
r=list(map(int,input().split()))
g=list(map(int,input().split()))
m=list(map(int,input().split()))
r.sort(reverse=True)
g.sort(reverse=True)
a=r[:x]+g[:y]+m
a.sort(reverse=True)
print((sum(a[:x+y])))
# Original solution
X, Y, R, G, N = list(map(int, input().split()))
r = [int(x) for x in input().split()]
g = [int(x) for x in input().split()]
n = [int(x) for x in input().split()]
r = sorted(r)[R-X:]
g = sorted(g)[G-Y:]
n = sorted(n, reverse=True)

nr = 0; ng = 0; nn = 0
for i in range(N):
    if n[nn] <= min(r[nr], g[ng]):
        break
    if r[nr] < g[ng]:
        r[nr] = n[nn]
        nr += 1
        if nr == X:
            nr = X-1
    else:
        g[ng] = n[nn]
        ng += 1
        if ng == Y:
            ng = Y-1
    nn += 1

print((sum(r) + sum(g)))

# Optimized solution
X, Y, R, G, N = list(map(int, input().split()))
r = [int(x) for x in input().split()]
g = [int(x) for x in input().split()]
n = [int(x) for x in input().split()]
r = sorted(r)[R-X:]
g = sorted(g)[G-Y:]

apple = r + g + n
apple = sorted(apple)[len(apple)-(X+Y):]
print((sum(apple)))
# 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)
ans=0

z=x+y

while(z!=0):
    while((x!=0)and(y!=0)):
            a=[]
            a.append(p[0])
            a.append(q[0])
            a.append(r[0])
            if max(a)==p[0]:
                x-=1
                z-=1
                ans+=p[0]
                p=p[1:]
            elif max(a)==q[0]:
                y-=1
                z-=1
                ans+=q[0]
                q=q[1:]
            else:
                z-=1
                ans+=r[0]
                r=r[1:]
        
    if x==0:
        if q[0]>=r[0]:
            y-=1
            z-=1
            ans+=q[0]
            q=q[1:] 
        else:
            z-=1
            ans+=r[0]
            r=r[1:]
    elif y==0:
        if p[0]>=r[0]:
            x-=1
            z-=1
            ans+=p[0]
            p=p[1:] 
        else:
            z-=1
            ans+=r[0]
            r=r[1:]
print(ans)

# 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()
r.sort()
ans=0

z=x+y

while(z!=0):
    while((x!=0)and(y!=0)):
            a=[]
            a.append(p[-1])
            a.append(q[-1])
            a.append(r[-1])
            if max(a)==p[-1]:
                x-=1
                z-=1
                ans+=p[-1]
                p.pop()
            elif max(a)==q[-1]:
                y-=1
                z-=1
                ans+=q[-1]
                q.pop()
            else:
                z-=1
                ans+=r[-1]
                r.pop()
            if z==0:
                break
            if  len(r)==0:
                break
    if len(r)==0:
        break
    if z==0:
        break
        
    if x==0:
        if q[-1]>=r[-1]:
            y-=1
            z-=1
            ans+=q[-1]
            q.pop() 
        else:
            z-=1
            ans+=r[-1]
            r.pop()
            
            
    elif y==0:
        if p[-1]>=r[-1]:
            x-=1
            z-=1
            ans+=p[-1]
            p.pop()
        else:
            z-=1
            ans+=r[-1]
            r.pop()

            
            
if len(r)==0:
    while(z!=0):
        while((x!=0)and(y!=0)):
            a=[]
            a.append(p[-1])
            a.append(q[-1])
            if max(a)==p[-1]:
                x-=1
                z-=1
                ans+=p[-1]
                p.pop()
            elif max(a)==q[-1]:
                y-=1
                z-=1
                ans+=q[-1]
                q.pop()
            if z==0:
                break
        if z==0:
            break
        if x==0:
            y-=1
            z-=1
            ans+=q[-1]
            q.pop() 
        else: 
            x-=1
            z-=1
            ans+=p[-1]
            p.pop()
        
        
        
        
        
        
        
        
        
        
        
        
        
print(ans)
# Original solution
import sys
import heapq

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

X,Y,A,B,C = list(map(int, readline().split()))

P = list(map(int, readline().split()))
Q = list(map(int, readline().split()))
R = list(map(int, readline().split()))

P = sorted(P, reverse=True)[:X]
Q = sorted(Q, reverse=True)[:Y]
R.sort(reverse=True)

heapq.heapify(P)
heapq.heapify(Q)

for r in R:
    p = heapq.heappop(P)
    q = heapq.heappop(Q)

    if p <= q and p < r:
        heapq.heappush(P, r)
        heapq.heappush(Q, q)
    elif q < r:
        heapq.heappush(Q, r)
        heapq.heappush(P, p)
    else:
        heapq.heappush(P, p)
        heapq.heappush(Q, q)

print((sum(P) + sum(Q)))

# Optimized solution
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

X,Y,A,B,C = list(map(int, readline().split()))

P = sorted(list(map(int, readline().split())),reverse=True)
Q = sorted(list(map(int, readline().split())),reverse=True)
R = sorted(list(map(int, readline().split())),reverse=True)

lis = P[:X] + Q[:Y] + R

print((sum(sorted(lis,reverse=True)[:X+Y])))
# Original solution
x,y,a,b,c = list(map(int,input().split()))
p = input().split()
p = [int(s) for s in p]
q = input().split()
q = [int(s) for s in q]
r = input().split()
r = [int(s) for s in r]
reds = sorted(p,reverse=True)
reds = reds[:x]
greens = sorted(q,reverse=True)
greens = greens[:y]
r = sorted(r,reverse=True)
while len(r) > 0 and (r[0] > reds[x-1] or r[0] > greens[y-1]):
    if(reds[x-1] > greens[y-1]):
        del greens[y-1]
        greens.insert(0,r.pop(0))
    else:
        del reds[x-1]
        reds.insert(0,r.pop(0))

print((sum(reds)+sum(greens)))

# Optimized solution
x,y,a,b,c = list(map(int,input().split()))
p = input().split()
p = [int(s) for s in p]
q = input().split()
q = [int(s) for s in q]
r = input().split()
r = [int(s) for s in r]
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
s = p[:x] + q[:y] + r
s.sort(reverse=True)
print((sum(s[:x+y])))
# Original solution
import sys
input = sys.stdin.readline
import heapq
X, Y, A, B, C = list(map(int, 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)

red = p[:X]
green = q[:Y]
heapq.heapify(red)
heapq.heapify(green)

while True :
    if not r :
        break
    if red[0] > green[0] :
        if green[0] < r[0] :
            heapq.heapreplace(green, r[0])
            r.pop(0)
        else :
            break
    else :
        if red[0] < r[0] :
            heapq.heapreplace(red, r[0])
            r.pop(0)
        else :
            break

print((sum(red)+sum(green)))

# Optimized solution
import sys
input = sys.stdin.readline
X, Y, A, B, C = list(map(int, 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)
red = p[:X]
green = q[:Y]
ans = red + green + r
ans.sort(reverse = True)
print((sum(ans[:X+Y])))
# Original solution
(x,y,a,b,c),*t=[list(map(int,t.split()))for t in open(0)]
s=sorted
p,q,r=list(map(s,t))
print((sum(s(p[-x:]+q[-y:]+r)[-x-y:])))

# Optimized solution
(x,y,*_),*t=[list(map(int,t.split()))for t in open(0)]
s=sorted
p,q,r=list(map(s,t))
print((sum(s(p[-x:]+q[-y:]+r)[-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()))

p.sort()
q.sort()
r.sort()

ans = 0

cnt = 0

while x+y-cnt > 0:
    if x > 0:
        p1 = p[-1]
    else:
        p1 = 0
    if y > 0:
        p2 = q[-1]
    else:
        p2 = 0
    if cnt < c:
        p3 = r[-1]
    else:
        p3 = 0
    eat = max(p1,p2,p3)
    ans += eat
    if x > 0 and p[-1] == eat:
        x -= 1
        p.pop()
    elif y > 0 and q[-1] == eat:
        y -= 1
        q.pop()
    else:
        cnt += 1
        r.pop()
print(ans)


# 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()
r.sort()
ans = p[a-x:]+q[b-y:]+r
ans.sort()
print((sum(ans[c:])))
# 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()))

PR = sorted(P + R, reverse = True)
QR = sorted(Q + R, reverse = True)

ans = 0
for i in range(X):
  ans += PR[i]
  if PR[i] in R:
    if PR[i] in QR:
      QR.remove(PR[i])
#print(ans)
for i in range(Y):
  ans += QR[i]
  
print(ans)


# Optimized solution
X, Y, A, B, C = list(map(int, input().split()))
P = sorted(list(map(int, input().split())), reverse = True)
Q = sorted(list(map(int, input().split())), reverse = True)
R = list(map(int, input().split()))

P = P[:X]
Q = Q[:Y]

D = P + Q + R
D = sorted(D, reverse = True)

print((sum(D[:(X + Y)])))
# Original solution
from collections import deque

x,y,a,b,c=list(map(int, input().split()))
pi=list(map(int,input().split()))
qi=list(map(int,input().split()))
ri=list(map(int,input().split()))
pi.sort(reverse=True)
qi.sort(reverse=True)
ri.sort(reverse=True)
ri=deque(ri)

apple=pi[:x]+qi[:y]
apple.sort(reverse=True)
apple=deque(apple)
while min(apple) <= ri[0]:
    c=ri.popleft()
    apple[-1]=c
    if len(ri)==0:
        break
print((sum(apple)))

# Optimized solution
from collections import deque
x,y,a,b,c=list(map(int, input().split()))
pi=list(map(int,input().split()))
qi=list(map(int,input().split()))
ri=list(map(int,input().split()))
pi.sort(reverse=True)
qi.sort(reverse=True)

apple=pi[:x]+qi[:y]+ri
apple.sort(reverse=True)

print((sum(apple[:x+y])))
# Original solution
import heapq
import sys
from itertools import accumulate
from collections import defaultdict

input = sys.stdin.readline

def main():
    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()))
    ans = 0
    P_d = defaultdict(int)
    Q_d = defaultdict(int)
    R_d = defaultdict(int)

    for i in range(len(P)):
        P[i] = -P[i]
        P_d[P[i]] += 1
        
    for i in range(len(Q)):
        Q[i] = -Q[i]
        Q_d[Q[i]] += 1

    
    for i in range(len(R)):
        R[i] = -R[i]
        R_d[R[i]] += 1

    H = P + Q + R
    heapq.heapify(H)
    red = 0
    green = 0
    nocl = 0
    ans = 0
    for i in range(A + B + C):
        tmp = heapq.heappop(H)
        if red + green + nocl == X + Y:
            print((-ans))
            exit()

        if P_d[tmp] >= 1 and red < X:
            P_d[tmp] -= 1
            red += 1
            ans += tmp
        elif Q_d[tmp] >= 1 and green < Y:
            Q_d[tmp] -= 1
            green += 1
            ans += tmp
        elif R_d[tmp] >= 1:
            R_d[tmp] -= 1
            nocl += 1
            ans += tmp
    





if __name__ == "__main__":
    main()

# Optimized solution
from collections import defaultdict

def main():
    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()))
    d_p = defaultdict(int)
    d_q = defaultdict(int)
    d_r = defaultdict(int)
    for p in P:
        d_p[p] += 1
    for q in Q:
        d_q[q] += 1
    for r in R:
        d_r[r] += 1
    D = P + Q + R
    D.sort(reverse=True)
    ans = 0
    x = 0
    y = 0
    c = 0
    for i in range(A + B + C):
        if x + y + c >= X + Y:
            break

        if x < X and d_p[D[i]]:
            ans += D[i]
            x += 1
            d_p[D[i]] -= 1
        elif y < Y and d_q[D[i]]:
            ans += D[i]
            y += 1
            d_q[D[i]] -= 1
        elif d_r[D[i]]:
            ans += D[i]
            c += 1
            d_r[D[i]] -= 1

    print(ans)

if __name__ == "__main__":
    main()
# Original solution
x,y,a,b,c=list(map(int,input().split()))
p=sorted(list(map(int,input().split())))[-x:]
q=sorted(list(map(int,input().split())))[-y:]
r=sorted(list(map(int,input().split())))
for i in range(len(p)):
  r.append(p[i])
for i in range(len(q)):
  r.append(q[i])
r=sorted(r)[-x-y:]
print((sum(r)))



# Optimized solution
x,y,a,b,c=list(map(int,input().split()))
p=sorted(list(map(int,input().split())))[-x:]
q=sorted(list(map(int,input().split())))[-y:]
print((sum(sorted(list(map(int,input().split()))+p+q)[-x-y:])))