Buggy python submission (verdict: Runtime Error):
# coding: utf-8
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)

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

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

EP.reverse()
EQ.reverse()

ans=sum(EP)+sum(EQ)

p=0
q=0

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

print(ans)




Fixed submission:
# coding: utf-8
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)

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

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

EP.reverse()
EQ.reverse()

ans=sum(EP)+sum(EQ)

p=0
q=0

INF=10**12

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

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

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
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)

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

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

EP.sort()
EQ.sort()

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

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




Fixed submission:
# coding: utf-8
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)

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

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

EP.reverse()
EQ.reverse()

ans=sum(EP)+sum(EQ)

p=0
q=0

INF=10**12

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

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

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
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)

EP=[]
EQ=[]

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

EP.sort()
EQ.sort()

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

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




Fixed submission:
# coding: utf-8
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)

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

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

EP.reverse()
EQ.reverse()

ans=sum(EP)+sum(EQ)

p=0
q=0

INF=10**12

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

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

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
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)

EP=[]
EQ=[]

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

EP.sort()
EQ.sort()

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

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




Fixed submission:
# coding: utf-8
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)

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

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

EP.reverse()
EQ.reverse()

ans=sum(EP)+sum(EQ)

p=0
q=0

INF=10**12

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

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

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
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)

EP=[]
EQ=[]

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

EP.sort()
EQ.sort()

while R[0]>EP[0] or R[0]>EQ[0]:
    if EP[0]<EQ[0]:
        EP.pop(0)
        EP.append(R.pop(0))
    else:
        EQ.pop(0)
        EQ.append(R.pop(0))
        
    if not(R):
        break

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




Fixed submission:
# coding: utf-8
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)

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

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

EP.reverse()
EQ.reverse()

ans=sum(EP)+sum(EQ)

p=0
q=0

INF=10**12

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

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

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
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)

EP=[]
EQ=[]

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

EP.sort()
EQ.sort()

while R[0]>EP[0] or R[0]>EQ[0]:
    if EP[0]<EQ[0]:
        EP.pop(0)
        EP.append(R.pop(0))
    else:
        EQ.pop(0)
        EQ.append(R.pop(0))
        
    if not(R):
        break

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




Fixed submission:
# coding: utf-8
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)

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

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

EP.reverse()
EQ.reverse()

ans=sum(EP)+sum(EQ)

p=0
q=0

INF=10**12

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

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

print(ans)