You are going to eat X red apples and Y green apples.

You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C.

Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively.

From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible.

Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.

-----Constraints-----
 - 1 \leq X \leq A \leq 10^5
 - 1 \leq Y \leq B \leq 10^5
 - 1 \leq C \leq 10^5
 - 1 \leq p_i \leq 10^9
 - 1 \leq q_i \leq 10^9
 - 1 \leq r_i \leq 10^9
 - All values in input are integers.

-----Input-----
Input is given from Standard Input in the following format:
X Y A B C
p_1 p_2 ... p_A
q_1 q_2 ... q_B
r_1 r_2 ... r_C

-----Output-----
Print the maximum possible sum of the deliciousness of the eaten apples.

-----Sample Input-----
1 2 2 2 1
2 4
5 1
3

-----Sample Output-----
12

The maximum possible sum of the deliciousness of the eaten apples can be achieved as follows:
 - Eat the 2-nd red apple.
 - Eat the 1-st green apple.
 - Paint the 1-st colorless apple green and eat it.

Difficulty: interview

Starter code:

Solutions:
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(reverse=True); q.sort(reverse=True); r.sort()

    p = p[:X]
    q = q[:Y]
    s = p + q
    s.sort()

    rtmp = r.pop()
    for i in range(len(s)):
        if s[i] < rtmp:
            s[i] = rtmp
            if len(r) == 0:
                break
            rtmp = r.pop()
        else:
            break
    ans = sum(s)
    print(ans)


def __starting_point():
    main()

__starting_point()

x, y, a, b, c = 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)
print(sum(sorted(p[:x]+q[:y]+r, reverse=True)[:(x+y)]))

X, Y, A, B, C = [int(n) for n in input().split(" ")]

p = [int(n) for n in input().split(" ")]
q = [int(n) for n in input().split(" ")]
r = [int(n) for n in input().split(" ")]

R = sorted(p)
G = sorted(q)
T = sorted(r)

W = 0
GetR = 0
GetG = 0
GetS = 0

while GetS < X + Y:
    a = -1
    b = -1
    c = -1
    if len(R) > 0 and GetR < X:
        a = R[-1]
    if len(G) > 0 and GetG < Y:
        b = G[-1]
    if len(T) > 0:
        c = T[-1]

    t = max([a, b, c])
    index = [a, b, c].index(t)
    W += t
    #print(R, G, T)
    GetS += 1
    if index == 0:
        del(R[-1])
        GetR += 1
    if index == 1:
        del(G[-1])
        GetG += 1
    if index == 2:
        del(T[-1])

print(W)

x,y,a,b,c=map(int,input().split())
p=sorted(list(map(int,input().split())))[::-1][:x]
q=sorted(list(map(int,input().split())))[::-1][:y]
r=sorted(list(map(int,input().split())))[::-1]
r=r[:min(len(r),x+y)]
l=sum([p,q,r],[])
print(sum(sorted(l)[::-1][:x+y]))

x_aka,y_mid,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_aka = sorted(p,reverse=True)
q_mid = sorted(q,reverse=True)
r_mu = sorted(r,reverse=True)
#print(p_aka[:x_aka],q_mid[:y_mid],r_mu)
tmp = p_aka[:x_aka] + q_mid[:y_mid] + r_mu
sort_tmp = sorted(tmp,reverse=True)
#print(sort_tmp[:(x_aka+y_mid)])
print((sum(sort_tmp[:(x_aka+y_mid)])))


def LI():
    return list(map(int, input().split()))


X, Y, A, B, C = LI()
red = LI()
green = LI()
mu = LI()
red.sort(reverse=True)
green.sort(reverse=True)
ans = red[:X]+green[:Y]+mu
ans.sort(reverse=True)
total = 0
for i in range(X+Y):
    total += ans[i]
print(total)


import heapq
X,Y,A,B,C = 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)
i,j,k = 0,0,0
pmax = Plist[i]
qmax = Qlist[i]
rmax = Rlist[i]
Ans = 0
for _ in range(2*10**5):
    Ans += max(pmax,qmax,rmax)
    if pmax == max(pmax,qmax,rmax):
        i += 1
        if i != X:
            pmax = Plist[i]
        else:
            pmax = -1
    elif qmax == max(pmax,qmax,rmax):
        j += 1
        if j != Y:
            qmax = Qlist[j]
        else:
            qmax = -1
    else:
        k += 1
        try:
            rmax = Rlist[k]
        except:
            rmax = -1
    if i+j+k == X+Y:
        break
print(Ans)

X, Y, A, B, C = map(int, input().split())
p_list = list(map(int, input().split()))
q_list = list(map(int, input().split()))
r_list = list(map(int, input().split()))

p_list_max = sorted(p_list, reverse=True)
q_list_max = sorted(q_list, reverse=True)
r_list_max = sorted(r_list, reverse=True)

p_list_X = p_list_max[:X]
q_list_Y = q_list_max[:Y]

ans_list = []
ans_list.extend(p_list_X)
ans_list.extend(q_list_Y)
ans_list.extend(r_list_max)
ans_list_max = sorted(ans_list, reverse=True)

ans = 0
#print(p_list_X, q_list_Y, ans_list_max)
for i in range(X+Y):
    ans += ans_list_max[i]
print(ans)

X,Y,A,B,C = list(map(int,input().split()))
P = sorted(list(map(int,input().split())),reverse=True)[:X]
Q = sorted(list(map(int,input().split())),reverse=True)[:Y]
R = list(map(int,input().split()))

all = P + Q + R

all.sort(reverse=True)

print((sum(all[:X+Y])))


x,y,a,b,c=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)
q=sorted(q,reverse=True)
r=sorted(r)

box=[]

ans=0


for i in range(x):
    box.append(p[i])

for j in range(y):
    box.append(q[j])

box = box + r

box=sorted(box,reverse=True)

for k in range(x+y):
    ans+=box[k]

print(ans)

x, y, a, b, c = 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)

s = p[:x] + q[:y]
s.sort()
ans = sum(s)
for si, ri in zip(s, r):
    if si < ri:
        ans += ri - si

print(ans)

import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    X, Y, A, B, C = list(map(int, input().split()))
    P = sorted(list(map(int, input().split())), reverse=True)[:X]
    Q = sorted(list(map(int, input().split())), reverse=True)[:Y]
    R = sorted(list(map(int, input().split())), reverse=True)
    L = sorted(P + Q + R, reverse=True)
    res = sum(L[:X + Y])
    print(res)


def __starting_point():
    resolve()

__starting_point()

import numpy as np

x, y, a, b, c = map(int, input().split())

p = np.array(list(map(int, input().split())))
q = np.array(list(map(int, input().split())))
r = np.array(list(map(int, input().split())))

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

ans = p[-x:].sum()+q[-y:].sum()

p_cnt = 0
q_cnt = 0
r_cnt = 0
while not(-x+p_cnt == 0 and -y+q_cnt == 0) and -1-r_cnt >= -c:
  if -x+p_cnt == 0:
    if r[-1-r_cnt] > q[-y+q_cnt]:
      ans += r[-1-r_cnt] - q[-y+q_cnt]
      q_cnt += 1
      r_cnt += 1
    else:
      break
  
  elif -y+q_cnt == 0:
    if r[-1-r_cnt] > p[-x+p_cnt]:
      ans += r[-1-r_cnt] - p[-x+p_cnt]
      p_cnt += 1
      r_cnt += 1
    else:
      break

  elif p[-x+p_cnt] <= q[-y+q_cnt] and r[-1-r_cnt] > p[-x+p_cnt]:
    ans += r[-1-r_cnt] - p[-x+p_cnt]
    p_cnt += 1
    r_cnt += 1

  elif p[-x+p_cnt] > q[-y+q_cnt] and r[-1-r_cnt] > q[-y+q_cnt]:
    ans += r[-1-r_cnt] - q[-y+q_cnt]
    q_cnt += 1
    r_cnt += 1

  else:
    break

print(ans)

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

def main():
    import heapq
    x,y,a,b,c = list(map(int,input().split()))
    p = sorted(list(map(int,input().split())),reverse=True)[0:x]
    q = sorted(list(map(int,input().split())),reverse=True)[0:y]
    r = sorted(list(map(int,input().split())),reverse=True)
    P,Q = [],[]
    for i in range(x):
        heapq.heappush(P,p[i])
    for i in range(y):
        heapq.heappush(Q,q[i])
    for i in range(c):
        p,q = heapq.heappop(P), heapq.heappop(Q)
        if p>q:
            heapq.heappush(P,p)
            if r[i]>q:
                heapq.heappush(Q,r[i])
            else:
                heapq.heappush(Q,q)
        else:
            heapq.heappush(Q,q)
            if r[i]>p:
                heapq.heappush(P,r[i])
            else:
                heapq.heappush(P,p)
    print((sum(P)+sum(Q)))

def __starting_point():
    main()

__starting_point()

'''
Created on 2020/09/10

@author: harurun
'''
def main():
  import heapq
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
#   dl=[]

  X,Y,A,B,C=list(map(int,pin().split()))
  p=list(map(int,pin().split()))
  q=list(map(int,pin().split()))
  r=list(map(int,pin().split()))

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

  p=p[:X]
  q=q[:Y]
  
  Q=[]
  for i in p:
    Q.append([i,0])
  for j in q:
    Q.append([j,1])

  heapq.heapify(Q)
  cntp=0
  cntq=0
  ans=0
  for k in r:
    t=heapq.heappop(Q)
    if t[1]==0 and t[0]<k and cntp<=X:
      ans+=k 
      cntp+=1
#       dl.append(k)
    elif t[1]==1 and t[0]<k and cntq<=Y:
      ans+=k 
      cntq+=1
#       dl.append(k)
    else:
      ans+=t[0]
      break
  while True:
    try:
      s=heapq.heappop(Q)
      ans+=s[0] 
#       dl.append(s[0])
    except:
      break
  print(ans)
#   print(dl)
#   print(p)
#   print(q)
  
  return 

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(reverse=True)
q.sort(reverse=True)
ans=[]
for i in range(x):
  r.append(p[i])
for i in range(y):
  r.append(q[i])
r.sort(reverse=True)
print((sum(r[0:x+y])))
  



from collections import deque

X,Y,A,B,C = map(int, input().split())
A=[int(a) for a in input().split()]
B=[int(b) for b in input().split()]
C=[int(c) for c in input().split()]

A=sorted(A, reverse=True)[:X]
B=sorted(B, reverse=True)[:Y]
AB=deque(sorted(A+B))

for c in sorted(C, reverse=True):
  if c >= AB[0]:
    AB.popleft()
    AB.append(c)
  else:
    break

print(sum(AB))

import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

x,y,a,b,c = inpm()
p = list(reversed(sorted(inpl())))
q = list(reversed(sorted(inpl())))
r = list(reversed(sorted(inpl())))
pp = x-1
qq = y-1
rr = 0

tmp = []
tmp.extend(p[:pp+1])
tmp.extend(q[:qq+1])
tmp.extend(r)

tmp = list(reversed(sorted(tmp)))
ans = sum(tmp[:x+y])
print(ans)

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy,bisect
#from operator import itemgetter
#from heapq import heappush, heappop
#import numpy as np
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
#from scipy.sparse import csr_matrix
#from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
import sys

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
nf = lambda: float(ns())
na = lambda: list(map(int, stdin.readline().split()))
nb = lambda: list(map(float, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

X, Y, A, B, C = na()
p = na()
q = na()
r = na()
p.append(inf)
q.append(inf)
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
s1 = sum(p[1:X+1])
s2 = sum(q[1:Y+1])
p_idx = X
q_idx = Y
ans = s1 + s2
for i in range(C):
    now_r = r[i]
    now_p = p[p_idx]
    now_q = q[q_idx]
    #print(now_r, now_p, now_q)
    if now_r <= now_p and now_r <= now_q:
        break
    elif now_r > now_p and now_r > now_q:
        if now_p > now_q:
            ans = ans + now_r - now_q
            q_idx -= 1
        else:
            ans = ans + now_r - now_p
            p_idx -= 1
    elif now_r > now_p:
        ans = ans + now_r - now_p
        p_idx -= 1
    elif now_r > now_q:
        ans = ans + now_r - now_q
        q_idx -= 1
print(ans)

X,Y,a,b,c = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort()
B.sort()
C.sort()

ans = 0
if X < a:
    A = A[a-X:]
if Y < b:
    B = B[b-Y:]
ans = 0
for i in range(X+Y):
    if len(A) == 0:
        A.append(0)
    if len(B) == 0:
        B.append(0)
    if len(C) == 0:
        C.append(0)
    if max(A[-1],B[-1],C[-1]) == A[-1]:
        ans += A[-1]
        A.pop()
    elif max(A[-1],B[-1],C[-1]) == B[-1]:
        ans += B[-1]
        B.pop()
    else:
        ans += C[-1]
        C.pop()
print(ans)

x, y, a, b, c = list(map(int, input().split()))
plst = list(map(int, input().split()))
qlst = list(map(int, input().split()))
rlst = list(map(int, input().split()))
plst.sort()
qlst.sort()
rlst.sort(reverse = True)
inf = 10 ** 20
plst = plst[-x:] + [inf]
qlst = qlst[-y:] + [inf]
r_pos = 0
p_pos = 0
q_pos = 0
while 1:
    if rlst[r_pos] <= plst[p_pos] and rlst[r_pos] <= qlst[q_pos]:
        break
    elif plst[p_pos] < qlst[q_pos]:
        plst[p_pos] = rlst[r_pos]
        p_pos += 1
        r_pos += 1
    else:
        qlst[q_pos] = rlst[r_pos]
        q_pos += 1
        r_pos += 1
    if r_pos == c:
        break
print((sum(plst) + sum(qlst) - inf * 2))


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)

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

red_no_eat = 0
green_no_eat = 0
for no in r:
    red_worst = red[-red_no_eat - 1] if red_no_eat < X else 10 ** 10
    green_worst = green[-green_no_eat - 1] if green_no_eat < Y else 10 ** 10
    if no > red_worst or no > green_worst:
        if red_worst < green_worst:
            red_no_eat += 1
        else:
            green_no_eat += 1
print((sum(p[:X-red_no_eat]) + sum(q[:Y-green_no_eat]) + sum(r[:red_no_eat+green_no_eat])))


x, y, a, b, c = map(int, input().split())
p = sorted(map(int, input().split()))
q = sorted(map(int, input().split()))
r = sorted(map(int, input().split()))
ans = p[-x:] + q[-y:] + r
ans.sort()
n = len(ans)
cnt = 0
for i in range(x+y):
    cnt += ans[n-1-i]
print(cnt)

x,y,a,b,c=list(map(int,input().split()))
p=[0]+sorted(list(map(int,input().split())))[a-x:]
q=[0]+sorted(list(map(int,input().split())))[b-y:]
r=[0]+sorted(list(map(int,input().split())))
pi=-1
qi=-1
ri=-1
gs=0
rs=0
ws=0
s=0              
while gs+rs+ws!=x+y:
    if r[ri]>=q[qi]>=p[pi]:
        s += r[ri]
        ws+=1
        ri-=1

    elif r[ri]>=p[pi]>=q[qi]:
        s += r[ri]
        ws += 1
        ri -= 1

    elif q[qi]>=r[ri]>=p[pi]:
        s += q[qi]
        gs += 1
        qi -= 1

    elif q[qi]>=p[pi]>=r[ri]:
        s += q[qi]
        gs += 1
        qi -= 1

    elif p[pi]>=r[ri]>=q[qi]:
        s += p[pi]
        rs += 1
        pi -= 1

    elif p[pi]>=q[qi]>=r[ri]:
        s += p[pi]
        rs += 1
        pi -= 1

print(s)


X, Y, A, B, C = list(map(int, input().split()))
P = list([[int(s), 1] for s in input().split()])
Q = list([[int(s), 2] for s in input().split()])
R = list([[int(s), 0] for s in input().split()])
L = P+Q+R
L.sort(reverse=True, key=lambda x:x[0])
T = X + Y
nr, ng, total = 0, 0, 0
ans = 0
for i in range(A+B+C):
  a, l = L[i]
  if l==1 and nr<X:
    nr += 1
    ans += a
    total += 1
  if l==2 and ng<Y:
    ng += 1
    ans += a
    total += 1
  if l==0:
    ans += a
    total += 1
  if total == T:
    break
print(ans)
    


import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return list(map(int, input().split()))
def MI1(): return list(map(int1, input().split()))
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print((k.join(list(map(str, lst)))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque, defaultdict
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np    # cumsum
# from bisect import bisect_left, bisect_right

def solve():
    X, Y, A, B, C = MI()
    # R = LI()
    # G = LI()
    # T = LI()
    L = []
    for r in LI():
        L.append((r, 'R'))
    for g in LI():
        L.append((g, 'G'))
    for t in LI():
        L.append((t, 'T'))
    L = sorted(L, reverse=True)
    # print(L)

    ans = 0
    left = X + Y
    for n, c in L:
        if c == 'R':
            if X > 0:
                ans += n
                X -= 1
            else:
                continue
        elif c == 'G':
            if Y > 0:
                ans += n
                Y -= 1
            else:
                continue
        else:
            ans += n

        left -= 1
        if left == 0:
            print(ans)
            return

def __starting_point():
    solve()


__starting_point()

x,y,a,b,c = map(int, input().split())
l = [list(map(int, input().split())) for i in range(3)]
k = sorted(l[0],reverse=True)[:x]
for i in sorted(l[1],reverse=True)[:y]:
  k.append(i)
for i in l[2]:
  k.append(i)
m = sorted(k,reverse=True)[:x+y]
print(sum(m))

x, y, a, b, c = map(int,input().split())
datp = sorted(list(map(int, input().split())), reverse=True)
datq = sorted(list(map(int, input().split())), reverse=True)
datr = list(map(int, input().split()))
dat = sorted(datp[:x] + datq[:y] + datr, reverse=True)
print(sum(dat[:x+y]))

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

x=X-1
y=Y-1

p=sorted(p,reverse=True)
q=sorted(q,reverse=True)
r=sorted(r,reverse=True)

#print(p[:X],q[:Y])

if p[x]>=q[y]:
  a=q[y]
  f=1
else:
  a=p[x]
  f=2
while len(r)>=1 and a<r[0]:
#  print(a,r[0])
  if f==1 :
#    print('f=1')
    q[y]=r[0]
    y-=1
    r.pop(0)
  elif f==2 :
#    print('f=2')
    p[x]=r[0]
    x-=1
    r.pop(0)
  else:
#    print('break1')
    break
    
#  print(x,y,p[x],q[y])
    
  if (y==-1 and x>=0) or (x>=0 and p[x]<q[y]):
#    print('a=p[x]')
    a=p[x]
    f=2
  elif (x==-1 and y>=0) or (y>=0 and p[x]>=q[y]):
#    print('a=q[y]')
    a=q[y]
    f=1
  else:
#    print('break2')
    break

ans=0
#print(p[:X],q[:Y])
for i in p[:X]:
  ans+=i
for i in q[:Y]:
  ans+=i

print(ans)

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

x, y, a, b, c = map(int, input().split())
p_l = sorted(list(map(int, input().split())), reverse=True)[:x]
q_l = sorted(list(map(int, input().split())), reverse=True)[:y]
r_l = list(map(int, input().split()))
p_l = sorted(p_l + q_l + r_l, reverse=True)

print(sum(p_l[:x+y]))

import math
import sys
import collections
import bisect
readline = sys.stdin.readline


def main():
    x, y, a, b, c = list(map(int, input().split()))
    p = sorted(list(map(int, input().split())), reverse=True)[0:x]
    q = sorted(list(map(int, input().split())), reverse=True)[0:y]
    r = sorted(list(map(int, input().split())), reverse=True)
    pq = sorted((p + q))
    for i in range(min(c, (x + y))):
        if pq[i] > r[i]:
            break
        pq[i] = r[i]
    print((sum(pq)))


def __starting_point():
    main()

__starting_point()

x, y, a, b, c = list(map(int, input().split()))
p = [0]+list(map(int, input().split()))
q = [0]+list(map(int, input().split()))
r = [0]+list(map(int, input().split()))
p.sort()
q.sort()
r.sort()
ans = 0
num = x+y
for _ in range(num):
    if x > 0 and y > 0:
      i, j, k = p[-1], q[-1], r[-1]
      if i >= j and i >= k:
          ans += i
          p.pop()
          x -= 1
      elif j >= i and j >= k:
          ans += j
          q.pop()
          y -= 1
      else:
          ans += k
          r.pop()
    elif x > 0:
        i, j = p[-1], r[-1]
        x -= 1
        if i >= j:
            ans += i
            p.pop()
        else:
            ans += j
            r.pop()
    elif y > 0:
        y -= 1
        i, j = q[-1], r[-1]
        if i >= j:
            ans += i
            q.pop()
        else:
            ans += j
            r.pop()
    
print(ans)


import heapq
x,y,a,b,c = 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_tmp = P[:x]
y_tmp = Q[:y]

tmp_li = x_tmp+y_tmp
heapq.heapify(tmp_li)

for i in range(c):
    if R[i]>tmp_li[0]:
        heapq.heapreplace(tmp_li,R[i])
print(sum(tmp_li))

x,y,a,b,c=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
s=[]
for i in range(a):
    s.append([p[i],1])
for i in range(b):
    s.append([q[i],2])
for i in range(c):
    s.append([r[i],0])
s.sort(reverse=True)
o=0
X,Y,Z=0,0,0
for i in range(a+b+c):
    if s[i][1]==1 and X<x:
        X+=1
        Z+=1
        o+=s[i][0]
    elif s[i][1]==2 and Y<y:
        Y+=1
        Z+=1
        o+=s[i][0]
    elif s[i][1]==0:
        Z+=1
        o+=s[i][0]
    if Z==x+y:
        break
print(o)

from sys import stdin
nii=lambda: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)

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

x,y,a,b,c=nii()
p=sorted(lnii(),reverse=True)
q=sorted(lnii(),reverse=True)
r=sorted(lnii(),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)

x, y, a, b, c = map(int, input().split())
rs = [int(i) for i in input().split()]
gs = [int(i) for i in input().split()]
ws = [int(i) for i in input().split()]

rs.sort(reverse=True)
gs.sort(reverse=True)
ws.sort(reverse=True)
weight = 0
rs = rs[:x]
rs = [0] + rs
gs = gs[:y]
gs = [0] + gs
ws = [0] + ws
r = 0
g = 0
w = 0
while r + g + w < x + y:
  if r < x:
    w1 = weight + rs[r + 1]
  else:
    w1 = 0
  if g < y:
    w2 = weight + gs[g + 1]
  else:
    w2 = 0
  if w < c:
    w3 = weight + ws[w + 1]
  else:
    w3 = 0
  weight = max(w1, w2, w3)
  if weight == w1:
    r += 1
  elif weight == w2:
    g += 1
  elif weight == w3:
    w += 1
print(weight)

(x,y,a,b,c),p,q,r=[[*list(map(int,i.split()))]for i in open(0)]
print((sum(sorted(sorted(p)[-x:]+sorted(q)[-y:]+r)[-x-y:])))


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

pA = list(map(lambda x: (int(x), "a"), input().split()))
pB = list(map(lambda x: (int(x), "b"), input().split()))
pC = list(map(lambda x: (int(x), "c"), input().split()))

apples = sorted(pA + pB + pC)

cntA = 0
cntB = 0
cntC = 0
cnt = 0

while cntA + cntB + cntC < x+y:
    val, col = apples.pop()

    if col == "a" and cntA < x:
        cntA += 1
        cnt += val
    elif col == "b" and cntB < y:
        cntB += 1
        cnt += val
    elif col == "c":
        cntC += 1
        cnt += val

print(cnt)

from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter
from operator import mul
from functools import reduce


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)

pq = sorted(p+q)
ans = sum(pq)

for i in range(len(r)):
    if pq[i] < r[i]:
        ans = ans + r[i] -pq[i]
    else:
        break

print(ans)


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()))
from collections import deque

p.sort()
p=p[len(p)-X:]
q.sort()
q=q[len(q)-Y:]
r.sort(reverse=True)
p=deque(p)
q=deque(q)

for i in r:
  if min(p[0],q[0])>i:break
  if p[0]<q[0]:
    p.popleft()
    p.append(i)
  else:
    q.popleft()
    q.append(i)
print((sum(p)+sum(q)))


from collections import deque
x,y,a,b,c = map(int,input().split())
ls = []
la = list(map(int,input().split()))
lb = list(map(int,input().split()))
lc = list(map(int,input().split()))
la.sort(reverse=True)
lb.sort(reverse=True)
lc.sort(reverse=True)
for i in range(a):
    ls.append([la[i],1])
for j in range(b):
    ls.append([lb[j],2])
for l in range(c):
    ls.append([lc[l],3])
ls.sort(key=lambda x:x[0],reverse=True)
ls = deque(ls)
s,t,k = 0,0,0
cnt = 0
while True:
    now = ls.popleft()
    if now[1] == 1:
        if s < x:
            cnt += now[0]
            s += 1
    elif now[1] == 2:
        if t < y:
            cnt += now[0]
            t += 1
    else:
        cnt += now[0]
        k += 1
    if s + t + k == x + y:
        print(cnt)
        break

#ABC160
x, y, a, b, c = list(map(int, input().split()))
p = list(map(int, input().split())) # list()でリスト化、それを変数に代入。
q = list(map(int, input().split())) # list()でリスト化、それを変数に代入。
r = list(map(int, input().split())) # list()でリスト化、それを変数に代入。

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

eat = p + q + r

eat.sort(reverse = True)
eat = eat[:(x+y)]

print((sum(eat)))
#print(eat)


import math
import sys
import collections
import bisect
readline = sys.stdin.readline


def main():
    x, y, a, b, c = list(map(int, input().split()))
    print((sum(sorted((sorted(list(map(int, input().split())), reverse=True)[0:x] + sorted(list(map(int, input(
    ).split())), reverse=True)[0:y] + sorted(list(map(int, input().split())), reverse=True)), reverse=True)[0:(x + y)])))


def __starting_point():
    main()

__starting_point()

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)
p2=p[:x]
q2=q[:y]
num=p2+q2
num.sort()
ans=sum(num)
cnt=ans
for i in range(min(x+y,c)):
    cnt+=r[i]-num[i]
    ans=max(ans,cnt)
print(ans)


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

def main():
    x,y,a,b,c=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=[10**10]+p[:x]
    q=[10**10]+q[:y]
    r+=[0]*(a+b)
    ans=sum(p)+sum(q)-2*10**10
    pcnt,qcnt=0,0
    for i in range(x+y):
        if p[-1-pcnt] >= r[i] and q[-1-qcnt] >= r[i]:
            break
        elif p[-1-pcnt] > q[-1-qcnt]:
            ans += -q[-1-qcnt] + r[i]
            qcnt +=1
        else:
            ans += -p[-1-pcnt] + r[i]
            pcnt +=1
    print(ans)


def __starting_point():
    main()
__starting_point()

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)
P = P[:X]
Q.sort(reverse=True)
Q = Q[:Y]
sp = sum(P)
sq = sum(Q)
ans = sp+sq
R.sort(reverse=True)
import heapq  # heapqライブラリのimport
heapq.heapify(P)  # リストを優先度付きキューへ
heapq.heapify(Q)
p = heapq.heappop(P) # 最小値の取り出し
q = heapq.heappop(Q)
r = R.pop(0)
while p<r or q<r:
  #print(p,q,r,ans)
  if r-p > r-q:
    heapq.heappush(P, r)
    ans += r-p
    p = heapq.heappop(P)
  else:
    heapq.heappush(Q, r)
    ans += r-q
    q = heapq.heappop(Q)
  if len(R)==0:
    break
  r = R.pop(0)
  #print(p,q,r,ans)
print(ans)

#print(*ans[1:], sep='\n')


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

X,Y,A,B,C =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_new = P[-X::]
Q_new = Q[-Y::]


agg = P_new + Q_new +R
agg.sort()
print(sum(agg[-X-Y::]))

(x, y, a, b, c), p, q, r = [map(int, o.split()) for o in open(0)]
print(sum(sorted(sorted(p)[-x:] + sorted(q)[-y:] + list(r))[-x-y:]))

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(reverse=True)
    Q.sort(reverse=True)

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


def __starting_point():
    main()

__starting_point()

x,y,a,b,c=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)
all=sorted(p[:x]+q[:y]+r,reverse=True)
print(sum(all[:x+y]))

x,y,a,b,c = 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)
q = sorted(q, reverse=True)

pq = sorted(p[:x] + q[:y])
r = sorted(r)
ans=0
j = r.pop()
for i in pq:
  if i < j:
    ans += j
    j = 0
    if r:
      j = r.pop()
  else:
    ans += i
    
print(ans)

X, Y, A, B, C = map(int, input().split())
p_l = sorted(map(int,input().split()), reverse = True)
q_l = sorted(map(int,input().split()), reverse = True)
r_l = sorted(map(int,input().split()), reverse = True)
p = X
q = Y
r = 0
for i in range(min(X+Y, C)):
    if p == 0 and q == 0:
        break
    elif p == 0 and r_l[i] <= q_l[q-1]:
        break
    elif q == 0 and r_l[i] <= p_l[p-1]:
        break
    elif p == 0 and r_l[i] > q_l[q-1]:
        r, q = r+1, q-1
    elif q == 0 and r_l[i] > p_l[p-1]:
        r, p = r+1, p-1
    elif r_l[i] > q_l[q-1] and p_l[p-1] >= q_l[q-1]:
        r, q = r+1, q-1
    elif r_l[i] > p_l[p-1] and q_l[q-1] >= p_l[p-1]:
        r, p = r+1, p-1
    else:
        break
print(sum(p_l[:p])+sum(q_l[:q])+sum(r_l[:r]))

x, y, a, b, c = list(map(int, input().split()))
p = sorted(map(int, input().split()), reverse=True)
q = sorted(map(int, input().split()), reverse=True)
r = sorted(map(int, input().split()))
v = 0
c = sorted(p[0:x] + q[0:y])
for i in range(x + y):
    if len(r):
        if c[i] < r[-1]:
            c[i] = r.pop()
    else:
        break
print((sum(c)))


x, y, a, b, c = list(map(int, input().split()))
p = sorted(list(map(int, input().split())))[::-1]
q = sorted(list(map(int, input().split())))[::-1]
r = sorted(list(map(int, input().split())))[::-1]

u = sorted(p[:x] + q[:y] + r)[::-1]
print((sum(u[:x + y])))


import heapq
x,y,a,b,c=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(lambda x:-int(x),input().split()))
heapq.heapify(r)
for i in range(x):
    heapq.heappush(r,-p[i])
for i in range(y):
    heapq.heappush(r,-q[i])
ans=0
for i in range(x+y):
    ans-=heapq.heappop(r)
print(ans)

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

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


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)

x, y, a, b, c = 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)

L = P[:x] + Q[:y] + R
L.sort(reverse=True)
print(sum(L[:x+y]))

x,y,a,b,c = map(int, input().split())
l = [list(map(int, input().split())) for i in range(3)]
k = sorted(l[0],reverse=True)[:x]
for i in sorted(l[1],reverse=True)[:y]:
  k.append(i)
for i in l[2]:
  k.append(i)
m = sorted(k,reverse=True)[:x+y]
print(sum(m))

### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest
import heapq

def yn(b):
    print(("Yes" if b==1 else "No"))
    return

def resolve():
    readline=sys.stdin.readline

    X,Y,a,b,c=list(map(int, readline().rstrip().split()))

    R=list([int(x)*(-1) for x in readline().rstrip().split()])
    G=list([int(x)*(-1) for x in readline().rstrip().split()])
    C=list([int(x)*(-1) for x in readline().rstrip().split()])

    heapq.heapify(R)
    heapq.heapify(G)
    heapq.heapify(C)
    ans = []
    heapq.heapify(ans)

    for _ in range(X):
        a = heapq.heappop(R)
        heapq.heappush(ans,a)
    for _ in range(Y):
        a = heapq.heappop(G)
        heapq.heappush(ans,a)
    for _ in range(min(X+Y,c)):
        a = heapq.heappop(C)
        heapq.heappush(ans,a)
    a=0
    for _ in range(X+Y):
        a += heapq.heappop(ans) * -1

    print(a)
    #n=int(readline())
    #ss=readline().rstrip()
    #yn(1)

    return

if 'doTest' not in globals():
    resolve()
    return

### ----------------
### ここまで 
### ----------------


import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return list(map(int, input().split()))
def MI1(): return list(map(int1, input().split()))
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print((k.join(list(map(str, lst)))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque, defaultdict
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np    # cumsum
# from bisect import bisect_left, bisect_right

def solve():
    X, Y, A, B, C = MI()
    R = sorted(LI(), reverse=True)[:X]
    G = sorted(LI(), reverse=True)[:Y]
    T = LI()
    L = sorted(R + G + T, reverse=True)[:X+Y]
    print((sum(L)))

def __starting_point():
    solve()


__starting_point()

X,Y,A,B,C = 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 = sum(p[:X]) + sum(q[:Y])
x = X-1
y = Y-1
m = min(p[x],q[y])
n = 1
while len(r)>0 and r[0] > m:
    if n == 1:
        if p[x] > q[y]:
            ans += r[0] - q[y]
            y -= 1
        else:
            ans += r[0] - p[x]
            x -= 1
    else:
        ans += r[0] - m
        if x<0:
            y -= 1
        else:
            x -= 1
    r.pop(0)
    if y >= 0 and x >= 0:
        m = min(p[x],q[y])
    elif x >= 0 and y<0:
        m = p[x]
        n = 0
    elif y >= 0 and x<0:
        m = q[y]
        n = 0
    else:
        m = 10 ** 9 + 1
        n = 0
print(ans)

x,y,a,b,c = 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)

p2 = p[:x]
q2 = q[:y]

l = p2 + q2 + r
l.sort(reverse=True)

ans = sum(l[:x+y])
print(ans)

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


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

ans = 0
red_cnt = 0
green_cnt = 0
cnt = 0

heap = []
for i in range(len(p)):
    heapq.heappush(heap,(-p[i],0))
for i in range(len(q)):
    heapq.heappush(heap,(-q[i],1))
for i in range(len(r)):
    heapq.heappush(heap,(-r[i],2))

while len(heap):
    _x,_y = heapq.heappop(heap)
    if _y == 0 and red_cnt < x:
        red_cnt += 1
        ans += _x
        cnt += 1
    elif _y == 1 and green_cnt < y:
        green_cnt += 1
        ans += _x
        cnt += 1
    elif _y == 2:
        cnt += 1
        ans += _x

    if cnt == x + y:
        print((-ans))
        return


X,Y,A,B,C=map(int,input().split())
P=sorted(map(int,input().split()), reverse=True)[:X]
Q=sorted(map(int,input().split()), reverse=True)[:Y]
R=sorted(map(int,input().split()), reverse=True)[:X+Y]
i,j=X-1,Y-1
for r in R:
    if i==-1 and j==-1:
        break
    elif j==-1:
        if r>P[i]:
            P[i]=r
            i-=1
        else:
            break
    elif i==-1:
        if r>Q[j]:
            Q[j]=r
            j-=1
        else:
            break
    elif P[i]>Q[j]:
        if r>Q[j]:
            Q[j]=r
            j-=1
        else:
            break
    else:
        if r>P[i]:
            P[i]=r
            i-=1
        else:
            break
print(sum(P)+sum(Q))

from heapq import heapify, heappop, heappush

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

r = [-x for x in r]

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

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

heapify(p)
heapify(q)
heapify(r)

while r:
    pp = heappop(p)
    qq = heappop(q)
    rr = heappop(r)
    rr *= -1

    if pp >= rr and qq >= rr:
        heappush(p, pp)
        heappush(q, qq)
        break

    elif pp <= qq:
        heappush(q, qq)
        if pp < rr:
            heappush(p, rr)
    else:
        heappush(p, pp)
        if qq < rr:
            heappush(q, rr)

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

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 = R + P[: x] + Q[: y]
R.sort(reverse = True)
print((sum(R[: x + y])))


import sys
input = sys.stdin.readline

def main():
    X, Y, A, B, C = map(int, input().split())
    P = sorted(list(map(int, input().split())))
    Q = sorted(list(map(int, input().split())))
    R = sorted(list(map(int, input().split())))

    l = sorted(P[-X:] + Q[-Y:])
    ans = 0
    for i in range(len(l)):
        if len(R) > 0 and R[-1] > l[i]:
            ans += R.pop(-1)
        else:
            ans += l[i]
    print(ans)

def __starting_point():
    main()
__starting_point()

import heapq
from collections import deque
must_red, must_green, a,b,c = list(map(int,input().split()))
delicious_red_ls = list(map(int, input().split()))
delicious_green_ls = list(map(int, input().split()))
delicious_free_ls = list(map(int, input().split()))
delicious_red_ls.sort(reverse=True)
delicious_green_ls.sort(reverse=True)
first_red = delicious_red_ls[:must_red]
first_green = delicious_green_ls[:must_green]
first_set = first_green + first_red
first_set.sort()
delicious_free_ls.sort()

while delicious_free_ls:
    to_be_erased = heapq.heappop(first_set)
    erase = delicious_free_ls[-1]
    if to_be_erased < erase:
        new = delicious_free_ls.pop()
        heapq.heappush(first_set, new)
    else:
        heapq.heappush(first_set, to_be_erased)
        break
print((sum(first_set)))




X, Y, A, B, C = list(map(int, input().split()))
P = sorted(map(int, input().split()), reverse=True)[:X]
Q = sorted(map(int, input().split()), reverse=True)[:Y]
R = sorted(map(int, input().split()), reverse=True)

PQ = sorted(P+Q)
ans = sum(PQ)
for r, pq in zip(R, PQ):
    if r > pq:
        ans += r - pq
print(ans)


X, Y, A, B, C = map(int, input().split())
p = sorted(list(map(int, input().split())))[::-1]
q = sorted(list(map(int, input().split())))[::-1]
r = sorted(list(map(int, input().split())))[::-1]

i = X - 1
j = Y - 1
k = 0

p.append(float("INF"))
q.append(float("INF"))
r.append(-1)

while p[i] < r[k] or q[j] < r[k]:
    if p[i] < q[j]:
        i -= 1
        k += 1
    else:
        j -= 1
        k += 1

ans = 0
if i != -1:
    ans += sum(p[:i+1])
if j != -1:
    ans += sum(q[:j+1])
if k != 0:
    ans += sum(r[:k])

print(ans)

x,y,a,b,c  = map(int,input().split())
p=[int(x) for x in input().rstrip().split()]
q=[int(x) for x in input().rstrip().split()]
r=[int(x) for x in input().rstrip().split()]
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

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

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)

pq = sorted(P[:X] + Q[:Y])
cnt = 0
for i in range(min(C, X+Y)):
    if R[i] <= pq[i]: 
        break
    cnt += 1

ans = sum(pq[cnt:]) + sum(R[:cnt])

print(ans)


import heapq

X,Y,A,B,C=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)

#!/usr/bin/env python
# coding: utf-8

# In[10]:


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)


# In[14]:


p_list = p[:X]
q_list = q[:Y]
mylist = sorted(p_list + q_list + r, reverse=True)
ans = 0
for i in range(X+Y):
    ans += mylist[i]
print(ans)


# In[ ]:






from collections import deque

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

ALL = p + q + r
ALL.sort(reverse=True)
ALL = deque(ALL)

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

p = deque(p)
q = deque(q)
r = deque(r)

ans = 0
p_cnt = 0
q_cnt = 0
r_cnt = 0
loopcnt = 0
while loopcnt < X+Y:
    apple = ALL.popleft()
    if p_cnt < X and apple == p[0]:
        ans += p.popleft()
        p_cnt += 1
        loopcnt += 1
    elif q_cnt < Y and apple == q[0]:
        ans += q.popleft()
        q_cnt += 1
        loopcnt += 1
    elif r_cnt < C and apple == r[0]:
        ans += r.popleft()
        r_cnt += 1
        loopcnt += 1
print(ans)

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)

ans=[]
for i in range(x):
  ans.append(p[i])
  
for j in range(y):
  ans.append(q[j])
  
ans.sort()

heapq.heapify(ans)

for j in range(c):
  min_a=heapq.heappop(ans)
  if min_a<=r[j]:
    heapq.heappush(ans,r[j])
  else:
    heapq.heappush(ans,min_a)
    break
    
print((sum(ans)))




X, Y, A, B, C = map(int, input().split())
plist = list(map(int, input().split()))
qlist = list(map(int, input().split()))
rlist = list(map(int, input().split()))

plist.sort()
qlist.sort()
rlist.sort()

plist = plist[::-1][:X]
qlist = qlist[::-1][:Y]
rlist = rlist[::-1]

pqrlist = plist + qlist + rlist
pqrlist.sort()
pqrlist = pqrlist[::-1]

print(sum(pqrlist[:X+Y]))

import sys,math,collections,itertools,heapq
input = sys.stdin.readline
def f(n):
    return -1*int(n)

x,y,a,b,c=list(map(int,input().split()))
p=sorted(list(map(int,input().split())),reverse=1)[:x]
q=sorted(list(map(int,input().split())),reverse=1)[:y]
r=list(map(f,input().split()))

p = collections.deque(p)
q = collections.deque(q)
heapq.heapify(r)

tmp = -1*heapq.heappop(r)
while tmp > p[-1]:
    p.appendleft(tmp)
    tmp = p.pop()
    tmp = -1* heapq.heappushpop(r,-1*tmp)

while tmp > q[-1]:
    q.appendleft(tmp)
    tmp = q.pop()
    tmp = -1 * heapq.heappushpop(r,-1*tmp)

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

        


X, Y, A, B, C = [int(x) for x in input().split()]
p = sorted([int(x) for x in input().split()], reverse=True)[:X]
q = sorted([int(x) for x in input().split()], reverse=True)[:Y]
r = sorted([int(x) for x in input().split()], reverse=True)[:X + Y]

s = sorted(p + q + r, reverse=True)

ans = sum(s[:X + Y])

print(ans)

x,y,a,b,c=map(int,input().split())
red=list(map(int,input().split()))
green=list(map(int,input().split()))
colorless=list(map(int,input().split()))
temp=[]
red.sort(reverse=True)
green.sort(reverse=True)
colorless.sort(reverse=True)
for i in range(min(x,a)):
  temp.append(red[i])
for i in range(min(y,b)):
  temp.append(green[i])
for i in range(c):
  temp.append(colorless[i])
temp.sort(reverse=True)
ans=0
for i in range(x+y):
  ans+=temp[i]
print(ans)

import heapq
import sys
X, Y, A, B, C = list(map(int, input().split()))
Av = list(map(int, input().split()))
Bv = list(map(int, input().split()))
Cv = list(map(int, input().split()))
heapq.heapify(Av)
heapq.heapify(Bv)
heapq.heapify(Cv)
for i in range(A-X):
    heapq.heappop(Av)
for i in range(B-Y):
    heapq.heappop(Bv)
if C > X+Y:
    for i in range(C-(X+Y)):
        heapq.heappop(Cv)
    NotTake = X+Y
else:
    NotTake = C
total = X+Y
C = NotTake
for _ in range(NotTake):
    Amin = heapq.heappop(Av)
    Bmin = heapq.heappop(Bv)
    Cmin = heapq.heappop(Cv)
    if X > 0 and Amin == min(Amin, Bmin, Cmin):
        heapq.heappush(Bv, Bmin)
        heapq.heappush(Cv, Cmin)
        X -= 1
    elif Y > 0 and Bmin == min(Bmin, Cmin):
        heapq.heappush(Av, Amin)
        heapq.heappush(Cv, Cmin)
        Y -= 1
    elif C > 0:
        heapq.heappush(Av, Amin)
        heapq.heappush(Bv, Bmin)
        C -= 1
    if X == 0 or Y == 0 or C == 0:
        break
NotTake = X+Y+C-total
if X == 0:
    Iv = Bv
    Jv = Cv
    I = Y
    J = C
elif Y == 0:
    Iv = Av
    Jv = Cv
    I = X
    J = C
else:
    print((sum(Av)+sum(Bv)+sum(Cv)))
    return

for _ in range(NotTake):
    Imin = heapq.heappop(Iv)
    Jmin = heapq.heappop(Jv)
    if I > 0 and Imin == min(Imin, Jmin):
        heapq.heappush(Jv, Jmin)
        I -= 1
    elif J > 0:
        heapq.heappush(Iv, Imin)
        J -= 1
    if J == 0 or I == 0:
        break

print((sum(Av)+sum(Bv)+sum(Cv)))


import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    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.sort(reverse=True)
    Q.sort(reverse=True)

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

    print((sum(apple[: X + Y])))

    return


def __starting_point():
    main()

__starting_point()

x, y, a, b, c = map(int, input().split())
p_array = list(map(int, input().split()))
q_array = list(map(int, input().split()))
r_array = list(map(int, input().split()))

p_array_sort = sorted(p_array, reverse=True)
q_array_sort = sorted(q_array, reverse=True)
r_array_sort = sorted(r_array, reverse=True)

p_i = x - 1
q_i = y - 1

for r in r_array_sort:
    p = p_array_sort[p_i]
    q = q_array_sort[q_i]
    if r <= p and r <= q:
        break
    elif q <= p:
        q_array_sort[q_i] = r
        q_i = max(q_i - 1, 0)
    else:
        p_array_sort[p_i] = r
        p_i = max(p_i - 1, 0)

ans = sum(p_array_sort[:x]) + sum(q_array_sort[:y])
print(ans)

X, Y, A, B, C = list(map(int, input().split()))
Ps = list(map(int, input().split()))
Qs = list(map(int, input().split()))
Rs = list(map(int, input().split()))

Ps.sort(reverse=True)
Qs.sort(reverse=True)
Rs += Ps[:X] + Qs[:Y]

Rs.sort(reverse=True)

ans = sum(Rs[:X+Y])
print(ans)


X,Y,A,B,C=map(int,input().split())
*P,=sorted(map(int,input().split()))
*Q,=sorted(map(int,input().split()))
*R,=map(int,input().split())

P=P[-X:]
Q=Q[-Y:]
R=sorted(P+Q+R)
ans=sum(R[-(X+Y):])
print(ans)

x,y,a,b,c=list(map(int,input().split()))
p=[0]+sorted(list(map(int,input().split())))[a-x:]
q=[0]+sorted(list(map(int,input().split())))[b-y:]
r=[0]+sorted(list(map(int,input().split())))
pi=-1
qi=-1
ri=-1
gs=0
rs=0
ws=0
s=0              
while gs+rs+ws!=x+y:
    if r[ri]>=q[qi]>=p[pi]:
        s += r[ri]
        ws+=1
        ri-=1

    elif r[ri]>=p[pi]>=q[qi]:
        s += r[ri]
        ws += 1
        ri -= 1

    elif q[qi]>=r[ri]>=p[pi]:
        s += q[qi]
        gs += 1
        qi -= 1

    elif q[qi]>=p[pi]>=r[ri]:
        s += q[qi]
        gs += 1
        qi -= 1

    elif p[pi]>=r[ri]>=q[qi]:
        s += p[pi]
        rs += 1
        pi -= 1

    elif p[pi]>=q[qi]>=r[ri]:
        s += p[pi]
        rs += 1
        pi -= 1

print(s)


def main():
    import sys

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

    x, y, a, b, c = 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]))

def __starting_point():
    main()
__starting_point()

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())))[::-1]

i=j=k=0
oi=0
while i<c:
  if x>j and y>k:
    if p[j]>=q[k] and q[k]<r[i]:
      q[k]=r[i]
      k+=1
      i+=1
    elif p[j]<q[k] and p[j]<r[i]:
      p[j]=r[i]
      j+=1
      i+=1
  elif x>j:
    if p[j]<r[i]:
      p[j]=r[i]
      j+=1
      i+=1
  elif y>k:
    if q[k]<r[i]:
      q[k]=r[i]
      k+=1
      i+=1
  if oi==i:break
  oi=i

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



x,y,a,b,c = 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)
pq = sorted(p[:x] + q[:y])
ans = sum(pq)
i = 0
while i < min(a+b, c):
  if r[i] <= pq[i]:
    break
  ans += r[i] - pq[i]
  i += 1
print(ans)

x,y,a,b,c = map(int,input().split())
p = sorted([int(x) for x in input().split()])[::-1][:x]
q = sorted([int(x) for x in input().split()])[::-1][:y]
r = [int(x) for x in input().split()]
row = sorted(p+q+r)[::-1]
print(sum(row[:x+y]))

# import itertools
# import math
# from functools import reduce
# import sys
# sys.setrecursionlimit(500*500)
# import numpy as np
from collections import deque
# import heapq

# 入力
# N = int(input())
# S = input()
# n, *a = map(int, open(0))
X, Y, A, B, C = map(int, input().split())
Q_A = list(map(int, input().split()))
Q_B = list(map(int, input().split()))
Q_C = list(map(int, input().split()))
# A = list(map(lambda x: int(x)*(-1), input().split()))
# x_y = [list(map(int,input().split())) for _ in range(N)]
# S = input()

# B_C = sorted(B_C, reverse=True, key=lambda x:x[1])
# all_cases = list(itertools.permutations(P))
# a = list(itertools.combinations_with_replacement(range(1, M + 1), N))
# itertools.product((0,1), repeat=n)

# A = np.array(A)
# cum_A = np.cumsum(A)
# cum_A = np.insert(cum_A, 0, 0)

# edges = [list(map(int,input().split())) for _ in range(N - 1)]
# tree = [[] for _ in range(N + 1)]

# for edge in edges:
#     tree[edge[0]].append(edge[1])
#     tree[edge[1]].append(edge[0])

# depth = [-1] * (N + 1)
# depth[1] = 0
# count = [0] * (N + 1)

# for i in range(Q):
#     p, x = map(int, input().split())
#     count[p] += x

# def dfs(tree, s):
#     for l in tree[s]:
#         if depth[l[0]] == -1:
#             depth[l[0]] = depth[s] + 1
#             dfs(tree, l[0])
# dfs(tree, 1)

# 素因数分解
# def factorization(n):
#     arr = []
#     temp = n
#     for i in range(2, int(-(-n**0.5//1))+1):
#         if temp%i==0:
#             cnt=0
#             while temp%i==0:
#                 cnt+=1
#                 temp //= i
#             arr.append([i, cnt])
#     if temp!=1:
#         arr.append([temp, 1])
#     if arr==[]:
#         arr.append([n, 1])
#     return arr

# 約数列挙
# def make_divisors(n):
#     lower_divisors , upper_divisors = [], []
#     i = 1
#     while i*i <= n:
#         if n % i == 0:
#             lower_divisors.append(i)
#             if i != n // i:
#                 upper_divisors.append(n//i)
#         i += 1
#     return lower_divisors + upper_divisors[::-1]

# bfs
# tree = [[] for _ in range(N + 1)]
# edges = [list(map(int,input().split())) for _ in range(M)]

# for edge in edges:
#     tree[edge[0]].append(edge[1])
#     tree[edge[1]].append(edge[0])

# depth = [-1] * (N + 1)
# depth[1] = 0

# d = deque()
# d.append(1)

# ans = [0] * (N + 1)
# while d:
#  v = d.popleft()
#  for i in tree[v]:
#    if depth[i] != -1:
#      continue
#    depth[i] = depth[v] + 1
#    ans[i] = v
#    d.append(i)

# # ans = depth[2:]
# print('Yes')
# print(*ans[2:], sep="\n")

# def gcd_list(numbers):
#     return reduce(math.gcd, numbers)

# # 高速素因数分解準備
# MAXN = 10**6+10
# sieve = [i for i in range(MAXN+1)]
# p = 2
# while p*p <= MAXN:
#     if sieve[p] == p:
#         for q in range(2*p, MAXN+1, p):
#             if sieve[q] == q:
#                 sieve[q] = p
#     p += 1

Q_A = sorted(Q_A, reverse=True)[:X]
Q_B = sorted(Q_B, reverse=True)[:Y]
Q_C = sorted(Q_C, reverse=True)

cand = Q_A + Q_B + Q_C

cand = sorted(cand, reverse=True)
print(sum(cand[:(X + Y)]))

import numpy as np

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

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

p = p[-x:]
q = q[-y:]
if x+y < r.size:
	r = r[-x-y:]
apple = np.hstack([p, q, r])
apple.sort()

sweet = apple[-x-y:].sum()

# print(x,y,a,b,c)
# print(p,q,r)
# print(apple)
print(sweet)

(x,y,a,b,c),p,q,r=[[*list(map(int,i.split()))]for i in open(0)]
p=sorted(p)[-x:]
q=sorted(q)[-y:]
pq = sorted(p+q)
r.sort(reverse=True)
ans = sum(pq)
for i in range(min(c,x+y)):
    if r[i] > pq[i]:
        ans += r[i] - pq[i]
    else:
        break
print(ans)