Buggy python submission (verdict: Runtime Error):
import sys,math,copy,queue,itertools
from fractions import gcd
sys.setrecursionlimit(10**7)
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
_LI = lambda : [int(x)-1 for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())
INF = 10**18
MOD = 10**9 + 7
DD = ((1,0),(0,1),(-1,0),(0,-1))
X,Y,A,B,C = LI()
p = LI()
q = LI()
r = LI()
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
pa =  [0] + list(itertools.accumulate(p))
qa =  [0] + list(itertools.accumulate(q))
p = [INF] + p
q = [INF] + q
red = X
green = Y
t = 0
pl = 0
while p[red] < r[t] or q[green] < r[t]:
    pl += r[t]
    t += 1
    elif p[red] < q[green] :
        red -= 1
    else:
        green -= 1
    if t >=C or (green ==0 and red ==0): break
print (pa[red] + qa[green] + pl)

Fixed submission:
import sys,math,copy,queue,itertools
from fractions import gcd
sys.setrecursionlimit(10**7)
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
_LI = lambda : [int(x)-1 for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())
INF = 10**18
MOD = 10**9 + 7
DD = ((1,0),(0,1),(-1,0),(0,-1))
X,Y,A,B,C = LI()
p = LI()
q = LI()
r = LI()
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
pa =  [0] + list(itertools.accumulate(p))
qa =  [0] + list(itertools.accumulate(q))
p = [INF] + p
q = [INF] + q
red = X
green = Y
t = 0
pl = 0
while p[red] < r[t] or q[green] < r[t]:
    pl += r[t]
    t += 1
    if red == 0:
        green -= 1
    elif green == 0:
        red -= 1

    elif p[red] < q[green] :
        red -= 1
    else:
        green -= 1
    if t >=C or (green ==0 and red ==0): break
print (pa[red] + qa[green] + pl)

Buggy python submission (verdict: Runtime Error):
import sys,math,copy,queue,itertools
from fractions import gcd
sys.setrecursionlimit(10**7)
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
_LI = lambda : [int(x)-1 for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())
INF = 10**18
MOD = 10**9 + 7
DD = ((1,0),(0,1),(-1,0),(0,-1))
X,Y,A,B,C = LI()
p = LI()
q = LI()
r = LI()
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
pa =  [0] + list(itertools.accumulate(p))
qa =  [0] + list(itertools.accumulate(q))
p = [0] + p
q = [0] + q
red = X
green = Y
t = 0
pl = 0
while p[red] < r[t] or q[green] < r[t]:
    pl += r[t]
    t += 1
    if red == 0:
        green -= 1
    elif green == 0:
        red -= 1

    elif p[red] < q[green] :
        red -= 1
    else:
        green -= 1
    if t < 0 or (green ==0 and red ==0): break
print (pa[red] + qa[green] + pl)

Fixed submission:
import sys,math,copy,queue,itertools
from fractions import gcd
sys.setrecursionlimit(10**7)
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
_LI = lambda : [int(x)-1 for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())
INF = 10**18
MOD = 10**9 + 7
DD = ((1,0),(0,1),(-1,0),(0,-1))
X,Y,A,B,C = LI()
p = LI()
q = LI()
r = LI()
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
pa =  [0] + list(itertools.accumulate(p))
qa =  [0] + list(itertools.accumulate(q))
p = [INF] + p
q = [INF] + q
red = X
green = Y
t = 0
pl = 0
while p[red] < r[t] or q[green] < r[t]:
    pl += r[t]
    t += 1
    if red == 0:
        green -= 1
    elif green == 0:
        red -= 1

    elif p[red] < q[green] :
        red -= 1
    else:
        green -= 1
    if t >=C or (green ==0 and red ==0): break
print (pa[red] + qa[green] + pl)