CodeEff/ECCO huggingface dataset:
# 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()
del p[:a-x]
del q[:b-y]

s=p+q
s.sort()

i=c-1
while r[i]>s[0] and i>=0 :
    s[0]=r[i]
    s.sort()
    i -= 1

print((sum(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()
q.sort()
r.sort(reverse=True)
del p[:a-x]
del q[:b-y]

s=p+q
s.sort()
if s[0]<r[0]:
    s[0]=r[0]
    for i in range(1,c):
        if s[i]>=r[i]:
            break
        else:
            s[i]=r[i]

print((sum(s)))
# Original solution
import heapq
X, Y, A, B, C = list(map(int, input().split()))
P = sorted([int(i) for i in input().split()], reverse=True)
Q = sorted([int(i) for i in input().split()], reverse=True)
R = sorted([int(i) for i in input().split()], reverse=True)


hq = P[:X]+Q[:Y]
ans = sum(hq)
heapq.heapify(hq)  # リストhqのheap化

i = 0
while hq and i < len(R):
    t = heapq.heappop(hq)  # heap化されたリストhqから最小値を削除＆その最小値を出力
    if R[i] > t:
        ans = ans - t + R[i]
        i += 1
    else:
        break
print(ans)


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

S = sorted(P[:X]+Q[:Y]+R, reverse=True)

print((sum(S[:X+Y])))
# Original solution
import bisect

x, y, a, b, c = list(map(int, input().split()))
p = [int(_) for _ in input().split()]
q = [int(_) for _ in input().split()]
r = [int(_) for _ in input().split()]

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

x_list = p[-x:]
y_list = q[-y:]

while (min(x_list[0], y_list[0]) < r[-1]):
    if x_list[0] > y_list[0]:
        i = bisect.bisect_right(r, y_list[0])
        y_list.pop(0)
        target = r.pop(i)
        bisect.insort(y_list, target)
    else:
        i = bisect.bisect_right(r, x_list[0])
        x_list.pop(0)
        target = r.pop(i)
        bisect.insort(x_list, target)

    if len(r) == 0:
        break

print((sum(x_list) + sum(y_list)))

# Optimized solution
x, y, a, b, c = list(map(int, input().split()))
p = [int(_) for _ in input().split()]
q = [int(_) for _ in input().split()]
r = [int(_) for _ in input().split()]
 
p.sort()
q.sort()
r.sort()
 
x_list = p[-x:]
y_list = q[-y:]
all_apple = x_list + y_list + r
all_apple.sort()
 
print((sum(all_apple[-(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()))
result = 0
Z = 0
while (X>0 or Y>0) and X+Y-Z>0:
        
    p.sort(reverse=True)
    q.sort(reverse=True)
    r.sort(reverse=True)
    if (X>0 or Y>0) and X+Y-Z>0:
        if p[0]>=q[0] and p[0]>=r[0] and X > 0:
            result += p[0]
            
            p[0] = 0
            X-=1
        elif q[0]>=p[0] and q[0]>=r[0] and Y > 0:
            result += q[0]
            
            q[0] = 0
            Y-=1
        elif r[0]>=q[0] and r[0]>=p[0]:
        
            result += r[0]
            r[0] = 0
            Z+=1

        elif X > 0:
            result += p[0]
            
            p[0] = 0
            X-=1
        elif Y > 0:
            result += q[0]
            
            q[0] = 0
            Y-=1
       
print(result)


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

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

p.extend(q)
p.extend(r)

p.sort(reverse=True)
s=0
for i in range(X+Y):
    s+=p[i]
print(s)
# Original solution
x,y,a,b,c=[int(i) for i in input().split()]

red_list=[int(i) for i in input().split()]
green_list=[int(i) for i in input().split()]
non_col_list=[int(i) for i in input().split()]

red_list.sort()
green_list.sort()
non_col_list.sort()

eat_red=[]
eat_green=[]
for i in range(x):
    eat_red.append(red_list.pop())
for i in range(y):
    eat_green.append(green_list.pop())


ans_list=eat_green+eat_red+non_col_list
ans_list.sort()
ans=0
for i in range(x+y):
    ans+=ans_list.pop()

print(ans)

# Optimized solution
x,y,a,b,c=[int(i) for i in input().split()]
p=[int(i) for i in input().split()]
q=[int(i) for i in input().split()]
r=[int(i) for i in input().split()]

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

p=p[-x:]
q=q[-y:]

ans=p+q+r
ans.sort()
ans=ans[-x-y:]
print((sum(ans)))
# Original solution
# -*- coding: utf-8 -*-

from collections import deque

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

def sort(L):
  if len(L)==1:
    return L
  left = sort(L[:len(L)//2])
  right = sort(L[len(L)//2:])
  result = []
  left.append(-1)
  right.append(-1)
  left_index = 0
  right_index = 0
  while len(result)<len(L):
    if left[left_index]>=right[right_index]:
      result.append(left[left_index])
      left_index += 1
    else:
      result.append(right[right_index])
      right_index += 1
  return result

P = sort(P)[:X]
Q = sort(Q)[:Y]
R = sort(P+Q+R)[:X+Y]
print((sum(R)))

# Optimized solution
# -*- coding: utf-8 -*-

from collections import deque

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(P+Q+R, reverse=True)[:X+Y]

print((sum(R)))
# Original solution
# -*- coding: utf-8 -*-

from collections import deque

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(P+Q+R, reverse=True)[:X+Y]

print((sum(R)))

# 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 = sorted(P, reverse=True)[:X]
Q = sorted(Q, reverse=True)[:Y]
R = sorted(P+Q+R, reverse=True)[:X+Y]
print((sum(R)))
# 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)
P = P[:X]
Q = Q[:Y]
All = P + Q + R
All.sort(reverse = True)
print((sum(All[:X+Y])))

# Optimized solution
def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()

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

if __name__ == '__main__':
    main()
# 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)
ls = []
for i in range(X):
    ls.append(p[i])
for i in range(Y):
    ls.append(q[i])
while(r != []):
    minimum = min(ls)
    
    if r[0] > minimum:
        ls[ls.index(minimum)] = r[0]
    r.pop(0)
print((sum(ls)))

# 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)
ls = []
for i in range(X):
    ls.append(p[i])
for i in range(Y):
    ls.append(q[i])
ls.extend(r)
ls.sort(reverse = True)
print((sum(ls[:X+Y])))
# Original solution
from heapq import heapify, heappush, heappop
def greenandredapples():
    X, Y, A, B, C = list(map(int, input().split()))
    RedD = sorted(list(map(int, input().split())))
    GreenD = sorted(list(map(int, input().split())))
    Colorl = sorted(list(map(int, input().split())))

    considered = RedD[-X:] + GreenD[-Y:]
    #print(considered)
    replacements = len(Colorl)
    #print(Colorl)
    while replacements >= 0 and len(Colorl) > 0:
        heapify(considered)
        smallest = heappop(considered)
        #print("ffff", smallest)
        r = Colorl.pop(0)
        #print("gggg", r, Colorl)
        if smallest < r:
            heappush(considered, r)
        else:
            heappush(considered, smallest)
        #print("ccc", considered)
        replacements -= 1
    #print(considered)
    return sum(considered)
print((greenandredapples()))

# Optimized solution
def greenandredapples():
    X, Y, A, B, C = list(map(int, input().split()))
    RedD = sorted(list(map(int, input().split())))
    GreenD = sorted(list(map(int, input().split())))
    Colorl = sorted(list(map(int, input().split())))

    considered = RedD[-X:] + GreenD[-Y:]
    Colorl.extend(considered)
    return sum(sorted(Colorl,reverse=True)[:X+Y])

print((greenandredapples()))
# Original solution
x, y, a, b, c = list(map(int, input().split()))
p = sorted(list(map(int, input().split())), reverse=True)
pp = p[:]
q = sorted(list(map(int, input().split())), reverse=True)
qq = q[:]
r = sorted(list(map(int, input().split())), reverse=True)
rr = r[:]
ans1 = 0
for _ in range(x):
    if len(p) > 0 and len(r) > 0:
        if p[0] >= r[0]:
            ans1 += p.pop(0)
        else:
            ans1 += r.pop(0)
    elif len(p) > 0:
        ans1 += p.pop(0)
    else:
        ans1 += r.pop(0)
for _ in range(y):
    if len(q) > 0 and len(r) > 0:
        if q[0] >= r[0]:
            ans1 += q.pop(0)
        else:
            ans1 += r.pop(0)
    elif len(q) > 0:
        ans1 += q.pop(0)
    else:
        ans1 += r.pop(0)

ans2 = 0
for _ in range(y):
    if len(qq) > 0 and len(rr) > 0:
        if qq[0] >= rr[0]:
            ans2 += qq.pop(0)
        else:
            ans2 += rr.pop(0)
    elif len(qq) > 0:
        ans2 += qq.pop(0)
    else:
        ans2 += rr.pop(0)
for _ in range(x):
    if len(pp) > 0 and len(rr) > 0:
        if pp[0] >= rr[0]:
            ans2 += pp.pop(0)
        else:
            ans2 += rr.pop(0)
    elif len(pp) > 0:
        ans2 += pp.pop(0)
    else:
        ans2 += rr.pop(0)
print((max(ans1, ans2)))


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

l = pp + qq + r
l.sort(reverse=True)
print((sum(l[:(x + y)])))
# Original solution
apples = [(0, 'X') for x in range(300001)]
apples_idx = 0

def append_a(n):
    global apples
    global apples_idx
    apples[apples_idx] = (n, 'A')
    apples_idx += 1

def append_b(n):
    global apples
    global apples_idx
    apples[apples_idx] = (n, 'B')
    apples_idx += 1

def append_c(n):
    global apples
    global apples_idx
    apples[apples_idx] = (n, 'C')
    apples_idx += 1
    
X, Y, A, B, C = list(map(int, input().split()))
for i in input().split():
    append_a(int(i))

for i in input().split():
    append_b(int(i))

for i in input().split():
    append_c(int(i))

apples.sort(reverse=True)
xn, yn = 0, 0
value = 0

for i, apple in enumerate(apples):
    if xn == X and yn == Y:
        break
    if apple[1] == 'A':
        if xn == X:
            continue
        xn += 1
        value += apple[0]
        continue
    if apple[1] == 'B':
        if yn == Y:
            continue
        yn += 1
        value += apple[0]
        continue

    # Apple C
    next_type = 'C'
    if xn < X and yn < Y:
        for j in range(i+1, len(apples)):
            if apples[j][1] == 'A':
                next_type = 'A'
            elif apples[j][1] == 'B':
                next_type = 'B'
    elif xn < X:
        next_type = 'A'
    else:
        next_type = 'B'

    if next_type == 'A':
        xn += 1
        value += apple[0]
    else:
        yn += 1
        value += apple[0]

print(value)



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

apples = p[:X] + q[:Y] + r
apples.sort(reverse=True)

value = sum(apples[:X+Y])
print(value)
# 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)
np=p[0:x]
nq=q[0:y]
np.extend(nq)
np.sort()
for i in range(min(len(np),len(r))):
    if np[i]<r[0]:
        np[i]=r.pop(0)
print((sum(np)))

# 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)
np=p[0:x]
nq=q[0:y]
np.extend(nq)
m=min(np)
nr=[i for i in r if i>=m]
np.extend(nr)
np.sort(reverse=True)
print((sum(np[0:x+y])))
# Original solution
s = [int(e) for e in input().split()]
x = int(s[0])
y = int(s[1])
a = int(s[2])
b = int(s[3])
c = int(s[4])
a_l = [int(e) for e in input().split()]
b_l = [int(e) for e in input().split()]
c_l = [int(e) for e in input().split()]

a_l.sort(reverse=True)
b_l.sort(reverse=True)
c_l.sort(reverse=True)

apple = []
app=a_l[0:x]+b_l[0:y]
app.sort()

for c_app in c_l:
    if app[0]<c_app:
        app[0]=c_app
    app.sort()

apple_count=sum(app)

print(apple_count)

# Optimized solution
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: list(map(int, stdin.readline().split()))
nl = lambda: list(map(int, stdin.readline().split()))
x, y, a, b, c = nm()
p = nl()
q = nl()
r = nl()
p.sort()
q.sort()
l = p[-x:] + q[-y:]
l.sort()
r.sort()
for i in range(c):
    if l[i] < r[-1]:
        l[i] = r.pop()
    else:
        break
print((sum(l)))
# Original solution
X, Y, A, B, C = list(map(int, input().split()))
red = list(map(int, input().split()))
green = list(map(int, input().split()))
no = list(map(int, input().split()))

red = sorted(red, reverse=True)[:X]
green = sorted(green, reverse=True)[:Y]
no = sorted(no, reverse = True)[:X+Y]

for i in range(len(no)):
    minX = min(red)
    minY = min(green)
    
    if no[i]>minX or no[i]>minY:
        if minX<=minY:
            red[red.index(minX)] = no[i]
        else:
            green[green.index(minY)] = no[i]
    else:
        break
        
print((sum(red)+sum(green)))

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

red = sorted(red, reverse=True)[:X]
green = sorted(green, reverse=True)[:Y]
no = sorted(no, reverse = True)[:X+Y]

co = sorted(red+green)

for i in range(len(no)):
    if no[i]>co[i]:
        co[i] = no[i]
    else:
        break
        
print((sum(co)))
# Original solution
def main():
    import sys
    input = sys.stdin.buffer.readline
    X, Y, A, B, C = (int(i) for i in input().split())
    P = [-int(i) for i in input().split()]
    Q = [-int(i) for i in input().split()]
    R = [-int(i) for i in input().split()]
    from heapq import heapify, heappop
    heapify(P)
    heapify(Q)
    heapify(R)
    eatP = 0
    eatQ = 0
    eatR = 0
    ans = 0
    while X != eatP and Y != eatQ and eatP + eatQ + eatR < X + Y:
        if P and Q and R:
            cur = min(P[0], Q[0], R[0])
        elif P and Q:
            cur = min(P[0], Q[0])
        elif Q and R:
            cur = min(Q[0], R[0])
        elif R and P:
            cur = min(R[0], P[0])
        elif P:
            cur = P[0]
        elif Q:
            cur = Q[0]
        elif R:
            cur = R[0]
        else:
            break
        ans -= cur
        if R and R[0] == cur:
            heappop(R)
            eatR += 1
        elif P and P[0] == cur:
            heappop(P)
            eatP += 1
        elif Q and Q[0] == cur:
            heappop(Q)
            eatQ += 1

    if eatP + eatQ + eatR == X + Y:
        return print(ans)
    if X != eatP:
        while X != eatP and eatP + eatQ + eatR < X + Y:
            if R and P:
                cur = min(R[0], P[0])
            elif R:
                cur = R[0]
            elif P:
                cur = P[0]
            else:
                break
            ans -= cur
            if R and R[0] == cur:
                heappop(R)
                eatR += 1
            elif P and P[0] == cur:
                heappop(P)
                eatP += 1
    elif Y != eatQ:
        while Y != eatQ and eatP + eatQ + eatR < X + Y:
            if R and Q:
                cur = min(R[0], Q[0])
            elif R:
                cur = R[0]
            elif Q:
                cur = Q[0]
            else:
                break
            ans -= cur
            if R and R[0] == cur:
                heappop(R)
                eatR += 1
            elif Q and Q[0] == cur:
                heappop(Q)
                eatQ += 1
    print(ans)


if __name__ == '__main__':
    main()


# Optimized solution
def main():
    import sys
    input = sys.stdin.buffer.readline
    X, Y, A, B, C = (int(i) for i in input().split())
    P = [int(i) for i in input().split()]
    Q = [int(i) for i in input().split()]
    R = [int(i) for i in input().split()]
    P.sort(reverse=True)
    Q.sort(reverse=True)
    R.extend(P[:X])
    R.extend(Q[:Y])
    R.sort(reverse=True)
    print((sum(R[:X+Y])))


if __name__ == '__main__':
    main()
# Original solution
x, y, a, b, c = [int(i) for i in input().split()]
pa = [int(i) for i in input().split()]
pb = [int(i) for i in input().split()]
pc = [int(i) for i in input().split()]

pa = sorted(pa, reverse=True)
pa = pa[:x]
pb = sorted(pb, reverse=True)
pb = pb[:y]
pc = sorted(pc, reverse=True)

l = pa + pb
l = sorted(l, reverse=True)

for i in range(len(pc)):
  for j in range(len(l)):
    if pc[i] > l[j]:
      l[j] = pc[i]
    if j == len(l)-1:
      break
      
print((sum(l)))
  

# Optimized solution
x, y, a, b, c = [int(i) for i in input().split()]
pa = [int(i) for i in input().split()]
pb = [int(i) for i in input().split()]
pc = [int(i) for i in input().split()]

pa = sorted(pa, reverse=True)
pa = pa[:x]
pb = sorted(pb, reverse=True)
pb = pb[:y]
pc = sorted(pc, reverse=True)

l = pa + pb + pc
l = sorted(l, reverse=True)
l = l[:int(x+y)]
print((sum(l)))
# Original solution
import bisect
X,Y,A,B,C=list(map(int,input().split()))

AList=list(map(int,input().split()))
BList=list(map(int,input().split()))
CList=list(map(int,input().split()))

AList.sort(reverse=True)
BList.sort(reverse=True)
CList.sort(reverse=True)

alist = AList[0:X] + BList[0:Y]
clist = CList
alist.sort()
ans = sum(alist)
cnt = 0

for i in range(C):
  a = clist[i]
  b = bisect.bisect_left(alist,a)
  if i < b:
    ans += a
    cnt += 1



aa = sum(alist[:cnt])

print((int(ans -aa)))

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

AList=list(map(int,input().split()))
BList=list(map(int,input().split()))
CList=list(map(int,input().split()))

AList.sort(reverse=True)
BList.sort(reverse=True)
CList.sort(reverse=True)

alist = AList[0:X] + BList[0:Y] + CList
alist.sort(reverse=True)

print((int(sum(alist[:X+Y]))))
# Original solution
X, Y, A, B, C = list(map(int, input().split()))
p, pi = sorted(list(map(int, input().split())), reverse=True)[:X] + [-1], 0
q, qi = sorted(list(map(int, input().split())), reverse=True)[:Y] + [-1], 0
r, ri = sorted(list(map(int, input().split())), reverse=True) + [-1], 0
ans, nX, nY = 0, 0, 0
while nX < X or nY < Y:
    if r[ri] >= p[pi] and r[ri] >= q[qi]:
        if nX < X and nY < Y:
            if p[pi] >= q[qi]:
                nX += 1
            else:
                nY += 1
        elif nX < X:
            nX += 1
        elif nY < Y:
            nY += 1
        ans += r[ri]
        ri += 1
    elif p[pi] >= q[qi] and p[pi] >= r[ri]:
        if nX < X:
            nX += 1
            ans += p[pi]
            pi += 1
    elif q[qi] >= r[ri] and q[qi] >= p[pi]:
        if nY < Y:
            nY += 1
            ans += q[qi]
            qi += 1

print(ans)


# 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:]
r = list(map(int, input().split()))
print((sum(sorted(p + q + r)[-(X + Y):])))
# Original solution
import heapq
def main():
    x, y, a, b, c = list(map(int,input().split()))
    p_ins = list(map(int,input().split()))
    q_ins = list(map(int,input().split()))
    r_ins = list(map(int,input().split()))
    p = select(p_ins, x)
    q = select(q_ins, y)
    r = select(r_ins, min(c, x + y))
    res = 0
    for _ in range(x + y):
        if p[-1] <= r[-1] and q[-1] <= r[-1]:
            t = r.pop()
            res += t
        elif p[-1] <= q[-1]:
            t = q.pop()
            res += t
        else:
            t = p.pop()
            res += t
    print(res)

def select(array, length):
    ins = []
    res_l = []
    for part in array:
        heapq.heappush(ins,-part)
    for _ in range(length):
        res = heapq.heappop(ins)
        res_l = [-res] + res_l
    return [0] + res_l


if __name__ == "__main__":
    main()


# Optimized solution
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()))
    pp = select(p, x)
    qq = select(q, y)
    res = select(pp + qq + r, x + y)
    print((sum(res)))



def select(array, length):
    ins = []
    res_l = []
    for part in array:
        heapq.heappush(ins,-part)
    for _ in range(length):
        res = heapq.heappop(ins)
        res_l.append(-res)
    return res_l


if __name__ == "__main__":
    main()
# Original solution
from collections import deque

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)

opt_p = deque(p[:x])
opt_q = deque(q[:y])
opt_r = deque(r[:x+y])

while len(opt_r) > 0:
    if opt_p[-1] < opt_r[0] or opt_q[-1] < opt_r[0]:
        if opt_p[-1] < opt_q[-1]:
            opt_p.pop()
            opt_p.appendleft(opt_r.popleft())
        else:
            opt_q.pop()
            opt_q.appendleft(opt_r.popleft())
    else:
        break

print((sum(opt_p) + sum(opt_q)))


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

s = p[:x] + q[:y] + r[:x+y]
s.sort(reverse=True)
print((sum(s[:x+y])))