n1, n2, n3 = map(int, raw_input().strip().split(" "))
h1 = map(int, raw_input().strip().split(" "))
h2 = map(int, raw_input().strip().split(" "))
h3 = map(int, raw_input().strip().split(" "))
h1.reverse()
h2.reverse()
h3.reverse()
listStacks = [h1, h2, h3]
sommeh1, sommeh2, sommeh3 = sum(h1), sum(h2), sum(h3)
listSum = [sommeh1, sommeh2, sommeh3]
while ( (listSum[0] != listSum[1]) or (listSum[0] != listSum[2]) ):
toSub = listStacks[listSum.index(max(listSum))].pop()
listSum[listSum.index(max(listSum))] -= toSub
print listSum[0]