You are given three bags. Each bag contains a non-empty multiset of numbers. You can perform a number of operations on these bags. In one operation, you can choose any two non-empty bags, and choose one number from each of the bags. Let's say that you choose number $a$ from the first bag and number $b$ from the second bag. Then, you remove $b$ from the second bag and replace $a$ with $a-b$ in the first bag. Note that if there are multiple occurrences of these numbers, then you shall only remove/replace exactly one occurrence.

You have to perform these operations in such a way that you have exactly one number remaining in exactly one of the bags (the other two bags being empty). It can be shown that you can always apply these operations to receive such a configuration in the end. Among all these configurations, find the one which has the maximum number left in the end.


-----Input-----

The first line of the input contains three space-separated integers $n_1$, $n_2$ and $n_3$ ($1 \le n_1, n_2, n_3 \le 3\cdot10^5$, $1 \le n_1+n_2+n_3 \le 3\cdot10^5$) — the number of numbers in the three bags.

The $i$-th of the next three lines contain $n_i$ space-separated integers $a_{{i,1}}$, $a_{{i,2}}$, ..., $a_{{i,{{n_i}}}}$ ($1 \le a_{{i,j}} \le 10^9$) — the numbers in the $i$-th bag.


-----Output-----

Print a single integer — the maximum number which you can achieve in the end.


-----Examples-----

Input
2 4 1
1 2
6 3 4 5
5
Output
20
Input
3 2 2
7 5 4
2 9
7 1
Output
29


-----Note-----

In the first example input, let us perform the following operations:

$[1, 2], [6, 3, 4, 5], [5]$

$[-5, 2], [3, 4, 5], [5]$ (Applying an operation to $(1, 6)$)

$[-10, 2], [3, 4], [5]$ (Applying an operation to $(-5, 5)$)

$[2], [3, 4], [15]$ (Applying an operation to $(5, -10)$)

$[-1], [4], [15]$ (Applying an operation to $(2, 3)$)

$[-5], [], [15]$ (Applying an operation to $(-1, 4)$)

$[], [], [20]$ (Applying an operation to $(15, -5)$)

You can verify that you cannot achieve a bigger number. Hence, the answer is $20$.

Source: codeforces | Difficulty: HARD
Tags: Greedy algorithms

Constructive algorithms


Solutions:
import math
(n1, n2, n3) = map(int, input().split())
L1 = list(map(int, input().split()))
L2 = list(map(int, input().split()))
L3 = list(map(int, input().split()))
singleton_min = min([sum(L1), sum(L2), sum(L3)])
(min_1, min_2, min_3) = (min(L1), min(L2), min(L3))
doubleton_min = min_1 + min_2 + min_3 - max(min_1, min_2, min_3)
print(sum(L1) + sum(L2) + sum(L3) - min(doubleton_min, singleton_min) * 2)


from os import path
from io import BytesIO, IOBase
import sys
from heapq import heappush, heappop
from functools import cmp_to_key as ctk
from collections import deque, Counter, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input().rstrip()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
mod = 998244353
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def bo(i):
	return ord(i) - ord('0')
file = 1

def ceil(a, b):
	return (a + b - 1) // b

def solve():
	(n1, n2, n2) = mi()
	a = [li() for i in range(3)]
	tot = sum([sum(a[i]) for i in range(3)])
	for i in range(3):
		a[i].sort()
	res = 0
	for i in range(3):
		minus = 2 * a[i][0]
		mnx = 1000000000.0
		for j in range(3):
			if j == i:
				continue
			mnx = min(mnx, a[j][0])
		for j in range(1, len(a[i])):
			if mnx < a[i][j]:
				minus += 2 * mnx
				break
			else:
				minus += 2 * a[i][j]
				mnx -= a[i][j]
		res = max(res, tot - minus)
	print(res)
if file:
	if path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	else:
		input = sys.stdin.readline
solve()


(n1, n2, n3) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
sm = sum(a) + sum(b) + sum(c)
an = min(a)
bn = min(b)
cn = min(c)
s = [an + bn, an + cn, bn + cn, sum(a), sum(b), sum(c)]
s.sort()
print(sm - 2 * s[0])


from collections import Counter, defaultdict, deque
import sys
input = sys.stdin.readline

def solve():
	lens = [int(x) for x in input().split()]
	s1 = sorted([int(x) for x in input().split()])
	s2 = sorted([int(x) for x in input().split()])
	s3 = sorted([int(x) for x in input().split()])
	s1 = s1[:1] + ([sum(s1[1:])] if sum(s1[1:]) != 0 else [])
	s2 = s2[:1] + ([sum(s2[1:])] if sum(s2[1:]) != 0 else [])
	s3 = s3[:1] + ([sum(s3[1:])] if sum(s3[1:]) != 0 else [])
	ss = sorted(s1 + s2 + s3)
	best = ss[0] + ss[1]
	if lens[0] == 1:
		best = min(best, s1[0])
	if lens[1] == 1:
		best = min(best, s2[0])
	if lens[2] == 1:
		best = min(best, s3[0])
	print(sum(ss) - 2 * best)
tt = 1
for test in range(tt):
	solve()


from sys import stdin, stdout
from collections import *
from math import gcd, floor, ceil

def st():
	return list(stdin.readline().strip())

def li():
	return list(map(int, stdin.readline().split()))

def mp():
	return map(int, stdin.readline().split())

def inp():
	return int(stdin.readline())

def pr(n):
	return stdout.write(str(n) + '\n')
mod = 1000000007
INF = float('inf')

def solve():
	(a, b, c) = mp()
	x = li()
	y = li()
	z = li()
	(aa, bb, cc) = (min(x), min(y), min(z))
	(sa, sb, sc) = (sum(x), sum(y), sum(z))
	xx = min(aa + bb, bb + cc, cc + aa)
	zz = sum([sa, sb, sc]) - 2 * xx
	xx = min(sa, sb, sc)
	val = max(zz, sa + sb + sc - 2 * xx)
	pr(val)
for _ in range(1):
	solve()


import sys
from collections import defaultdict as dd
from collections import Counter as cc
from queue import Queue
import math
import itertools
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
input = lambda : sys.stdin.readline().rstrip()
(n1, n2, n3) = map(int, input().split())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a3 = list(map(int, input().split()))
q = min(a1)
w = min(a2)
e = min(a3)
s = min(q, w, e)
d = q + w + e - s - max(q, w, e) + s
r = min(sum(a1), sum(a2), sum(a3))
if d > r:
	print(sum(a1) + sum(a2) + sum(a3) - 2 * r)
else:
	print(sum(a1) + sum(a2) + sum(a3) - 2 * d)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush, nsmallest
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
from decimal import Decimal
mod = pow(10, 9) + 7

def data():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
(n1, n2, n3) = sp()
mat = [sorted(l()) for _ in range(3)]
s = [sum(i) for i in mat]
temp = [i[0] for i in mat]
s.sort()
temp.sort()
answer = max(s[-1] + s[-2] - s[0], sum(s) - 2 * temp[0] - 2 * temp[1])
out(answer)


(n1, n2, n3) = [int(x) for x in input().split()]
arr1 = [int(x) for x in input().split()]
arr2 = [int(x) for x in input().split()]
arr3 = [int(x) for x in input().split()]
(m1, m2, m3) = (min(arr1), min(arr2), min(arr3))
(s1, s2, s3) = (sum(arr1), sum(arr2), sum(arr3))
ans = 0
ans1 = s1 + s2 + s3
ans = max(ans, ans1 - 2 * s1)
ans = max(ans, ans1 - 2 * s2)
ans = max(ans, ans1 - 2 * s3)
ans = max(ans, ans1 - 2 * (m1 + m2))
ans = max(ans, ans1 - 2 * (m1 + m3))
ans = max(ans, ans1 - 2 * (m3 + m2))
print(ans)


import math, sys
from collections import defaultdict, Counter, deque
INF = float('inf')
MOD = int(1000000000.0) + 7
MAX = int(200000.0) + 1

def solve():
	(n1, n2, n3) = vars()
	a1 = sorted(array())
	a2 = sorted(array())
	a3 = sorted(array())
	ans = 0
	s1 = sum(a1)
	s2 = sum(a2)
	s3 = sum(a3)
	for i in range(n1):
		ans22 = a2[0] - s1 - s3 + s2 - a2[0] + a1[i]
		ans22 = a1[i] - ans22
		ans31 = a3[0] - s1 - s2 + s3 - a3[0] + a1[i]
		ans31 = a1[i] - ans31
		ans = max(ans, ans22, ans31)
	for i in range(n2):
		ans12 = a1[0] - s2 - s3 + s1 - a1[0] + a2[i]
		ans12 = a2[i] - ans12
		ans32 = a3[0] - s1 - s2 + s3 - a3[0] + a2[i]
		ans32 = a2[i] - ans32
		ans = max(ans, ans12, ans32)
	for i in range(n3):
		ans11 = a1[0] - s2 - s3 + s1 - a1[0] + a3[i]
		ans11 = a3[i] - ans11
		ans21 = a2[0] - s1 - s3 + s2 - a2[0] + a3[i]
		ans21 = a3[i] - ans21
		ans = max(ans, ans11, ans21)
	total = s1 + s2 + s3
	mini = [a1[0] + a2[0], a2[0] + a3[0], a3[0] + a1[0]]
	for i in range(3):
		ans = max(ans, total - 2 * mini[i])
	print(ans)

def main():
	t = 1
	for _ in range(t):
		solve()

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def input():
	return sys.stdin.readline().rstrip('\n').strip()

def print(*args, sep=' ', end='\n'):
	first = True
	for arg in args:
		if not first:
			sys.stdout.write(sep)
		sys.stdout.write(str(arg))
		first = False
	sys.stdout.write(end)

def vars():
	return map(int, input().split())

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


import itertools
import collections
import copy
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
mo = int(1000000000.0 + 7)

def exgcd(a, b):
	if not b:
		return (1, 0)
	(y, x) = exgcd(b, a % b)
	y -= a // b * x
	return (x, y)

def getinv(a, m):
	(x, y) = exgcd(a, m)
	return --1 if x == 1 else x % m

def comb(n, b):
	res = 1
	b = min(b, n - b)
	for i in range(b):
		res = res * (n - i) * getinv(i + 1, mo) % mo
	return res % mo
(n1, n2, n3) = map(int, input().split())
l1 = [int(i) for i in input().split()]
l2 = [int(i) for i in input().split()]
l3 = [int(i) for i in input().split()]
s1 = sum(l1)
s2 = sum(l2)
s3 = sum(l3)
ll = l1 + l2 + l3
ll.sort()
l1.sort()
l2.sort()
l3.sort()
s = sum(ll)
ans = max(s - 2 * l1[0] - 2 * l2[0], s - 2 * l1[0] - 2 * l3[0], s - 2 * l2[0] - 2 * l3[0])
ans = max(ans, s - 2 * s1)
ans = max(ans, s - 2 * s2)
ans = max(ans, s - 2 * s3)
print(ans)


for _ in range(1):
	(n1, n2, n3) = map(int, input().split())
	a1 = list(map(int, input().split()))
	a2 = list(map(int, input().split()))
	a3 = list(map(int, input().split()))
	a1.sort()
	a2.sort()
	a3.sort()
	s1 = sum(a1)
	s2 = sum(a2)
	s3 = sum(a3)
	s = s1 + s2 + s3
	d = min(a1[0] + a2[0], a2[0] + a3[0], a3[0] + a1[0], s1, s2, s3)
	res = s - 2 * d
	print(res)


(a, b, c) = map(int, input().strip().split())
(x, y, z) = (list(map(int, input().strip().split())), list(map(int, input().strip().split())), list(map(int, input().strip().split())))
H = sorted([min(x), min(y), min(z)])
(X, Y, Z) = (sum(x), sum(y), sum(z))
print(max(X + Y + Z - sum(H[:2]) * 2, X + Y + Z - 2 * min(X, Y, Z)))


try:
	(a, b, c) = map(int, input().split())
	arr1 = list(map(int, input().split()))
	arr2 = list(map(int, input().split()))
	arr3 = list(map(int, input().split()))
	mn = [min(arr1), min(arr2), min(arr3)]
	sm = [sum(arr1), sum(arr2), sum(arr3)]
	tot = sum(sm)
	x = min(min(mn[0] + mn[1], mn[1] + mn[2]), mn[0] + mn[2])
	ans = tot - 2 * x
	x = min(sm[0], min(sm[1], sm[2]))
	ans = max(ans, tot - 2 * x)
	print(ans)
except:
	pass


ns = []
ns += [int(x) for x in input().split(' ')]
A = [None] * 3
for i in range(3):
	A[i] = [int(x) for x in input().split(' ')]
s = list(map(sum, A))
opt = [None] * 3
for i in range(3):
	rest = [j for j in range(3) if j != i]
	B = [A[j] for j in range(3) if j != i]
	i0 = min(B[0])
	i1 = min(B[1])
	cand1 = abs(s[rest[0]] - s[rest[1]])
	cand2 = s[rest[0]] + s[rest[1]] - 2 * i0 - 2 * i1
	opt[i] = s[i] + max(cand1, cand2)
print(max(opt))


(n1, n2, n3) = map(int, input().split())
f = []
g = []
for _ in range(3):
	arr = list(map(int, input().split()))
	f.append(sum(arr))
	g.append(min(arr))
f.sort()
g.sort()
print(sum(f) - 2 * min(g[0] + g[1], f[0]))


import os
import sys
from io import BytesIO, IOBase
import heapq as h
from bisect import bisect_left, bisect_right
import time
from types import GeneratorType
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import defaultdict as dd, deque as dq, Counter as dc
import math, string
start_time = time.time()

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())

def getMat(n):
	return [getInts() for _ in range(n)]

def isInt(s):
	return '0' <= s[0] <= '9'
MOD = 10 ** 9 + 7

def solve():
	(N1, N2, N3) = getInts()
	A1 = getInts()
	A2 = getInts()
	A3 = getInts()
	A1.sort()
	A2.sort()
	A3.sort()
	sum1 = sum(A1)
	sum2 = sum(A2)
	sum3 = sum(A3)
	return max(sum1 + sum2 - sum3, sum1 + sum3 - sum2, sum2 + sum3 - sum1, sum1 + sum2 + sum3 - 2 * A1[0] - 2 * A2[0] - 2 * A3[0] + 2 * max(A1[0], A2[0], A3[0]))
print(solve())


import sys
input = sys.stdin.readline
(n1, n2, n3) = map(int, input().split())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a3 = list(map(int, input().split()))
mins = [min(a1), min(a2), min(a3)]
sums = [sum(a1), sum(a2), sum(a3)]
mins.sort()
ans = sum(sums) - 2 * min(sum(mins[:2]), min(sums))
print(ans)


import sys
input = sys.stdin.readline
(n1, n2, n3) = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
(Sa, Sb, Sc) = (sum(A), sum(B), sum(C))
(ma, mb, mc) = (min(A), min(B), min(C))
mn = min(Sa, Sb, Sc, ma + mb, ma + mc, mb + mc)
ans = Sa + Sb + Sc - 2 * mn
print(ans)


import sys
from collections import *
import math
import bisect

def input():
	return sys.stdin.readline()
(n1, n2, n3) = 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()
s1 = sum(a)
s2 = sum(b)
s3 = sum(c)
s = s1 + s2 + s3
maxx = max(s1 + s2 - s3, s1 - s2 + s3, -s1 + s2 + s3)
maxx = max(s - 2 * (a[0] + b[0]), s - 2 * (b[0] + c[0]), s - 2 * (c[0] + a[0]), maxx)
print(maxx)


def most_left(bags: [list, list, list]) -> int:
	sums = [sum(bag) for bag in bags]
	result = sum(sums)
	minimals = sorted([min(bag) for bag in bags])
	minimal = sum(minimals[:2])
	to_remove = min(min(sums), minimal)
	result -= 2 * to_remove
	return result
(n1, n2, n3) = [int(x) for x in input().split()]
bags = [[int(x) for x in input().split()] for i in range(3)]
print(most_left(bags))


inp_arr = lambda : list(map(int, input().split()))
(_, a, b, c) = (inp_arr(), inp_arr(), inp_arr(), inp_arr())
(s1, s2, s3, m1, m2, m3) = (sum(a), sum(b), sum(c), min(a), min(b), min(c))
print(s1 + s2 + s3 - 2 * min(m1 + m2, m1 + m3, m2 + m3, s1, s2, s3))


(n1, n2, n3) = map(int, input().split())
(a, b, c) = (list(map(int, input().split())), list(map(int, input().split())), list(map(int, input().split())))
(i, j, k, d, e, f) = (sum(a), sum(b), sum(c), min(a), min(b), min(c))
print(i + j + k - 2 * min(d + e, d + f, e + f, i, j, k))


sizes = list(map(int, input().split()))
bags1 = list(map(int, input().split()))
bags2 = list(map(int, input().split()))
bags3 = list(map(int, input().split()))
sizes.sort()
minbags = [min(x) for x in [bags1, bags2, bags3]]
minbags.sort()
minsum = min(sum(bags1), sum(bags2), sum(bags3))
ans = 0
if minsum < minbags[0] + minbags[1]:
	ans += -2 * minsum
else:
	ans += -2 * (minbags[0] + minbags[1])
ans += sum(bags1 + bags2 + bags3)
print(ans)


def main():
	(n1, n2, n3) = map(int, input().split(' '))
	(l1, l2, l3) = (list(map(int, input().split(' '))), list(map(int, input().split(' '))), list(map(int, input().split(' '))))
	(l1, l2, l3) = (sorted(l1), sorted(l2), sorted(l3))
	(l1_sum, l2_sum, l3_sum) = (sum(l1), sum(l2), sum(l3))
	lsts = [l1, l2, l3]
	sums = [l1_sum, l2_sum, l3_sum]
	ans = 0

	def comp(i1, i2, i3):
		ans = sums[i1] + sums[i3] - sums[i2]
		if len(lsts[i1]) > 1:
			ans = max(ans, sums[i1] + sums[i3] + sums[i2] - 2 * lsts[i1][0] - 2 * lsts[i2][0])
		return ans
	ans = max(comp(0, 1, 2), ans)
	ans = max(comp(0, 2, 1), ans)
	ans = max(comp(1, 0, 2), ans)
	ans = max(comp(1, 2, 0), ans)
	ans = max(comp(2, 1, 0), ans)
	ans = max(comp(2, 0, 1), ans)
	print(ans)
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from functools import cmp_to_key
from collections import deque, Counter
from heapq import heappush, heappop
from math import log, ceil
import sys
import os
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def ii():
	return int(inp())

def si():
	return str(inp())

def li(lag=0):
	l = list(map(int, inp().split()))
	if lag != 0:
		for i in range(len(l)):
			l[i] += lag
	return l

def mi(lag=0):
	matrix = list()
	for i in range(n):
		matrix.append(li(lag))
	return matrix

def lsi():
	return list(map(str, inp().split()))

def print_list(lista, space=' ', **kwargs):
	print(space.join(map(str, lista)), **kwargs)

def bisect_left(a, x):
	left = 0
	right = len(a)
	while left < right:
		mid = (left + right) // 2
		if a[mid] < x:
			left = mid + 1
		else:
			right = mid
	return left

def bisect_right(a, x):
	left = 0
	right = len(a)
	while left < right:
		mid = (left + right) // 2
		if a[mid] > x:
			right = mid
		else:
			left = mid + 1
	return left

def bisect_elements(a, x):
	return bisect_right(a, x) - bisect_left(a, x)
MOD = 10 ** 9 + 7
maxN = 5
FACT = [0] * maxN
INV_FACT = [0] * maxN

def add(x, y):
	return (x + y) % MOD

def multiply(x, y):
	return x * y % MOD

def power(x, y):
	if y == 0:
		return 1
	elif y % 2:
		return multiply(x, power(x, y - 1))
	else:
		a = power(x, y // 2)
		return multiply(a, a)

def inverse(x):
	return power(x, MOD - 2)

def divide(x, y):
	return multiply(x, inverse(y))

def allFactorials():
	FACT[0] = 1
	for i in range(1, maxN):
		FACT[i] = multiply(i, FACT[i - 1])

def inverseFactorials():
	n = len(INV_FACT)
	INV_FACT[n - 1] = inverse(FACT[n - 1])
	for i in range(n - 2, -1, -1):
		INV_FACT[i] = multiply(INV_FACT[i + 1], i + 1)

def coeffBinom(n, k):
	if n < k:
		return 0
	return multiply(FACT[n], multiply(INV_FACT[k], INV_FACT[n - k]))

def create_graph(n, m, undirected=1, unweighted=1):
	graph = [[] for i in range(n)]
	if unweighted:
		for i in range(m):
			[x, y] = li(lag=-1)
			graph[x].append(y)
			if undirected:
				graph[y].append(x)
	else:
		for i in range(m):
			[x, y, w] = li(lag=-1)
			w += 1
			graph[x].append([y, w])
			if undirected:
				graph[y].append([x, w])
	return graph

def create_tree(n, unweighted=1):
	children = [[] for i in range(n)]
	if unweighted:
		for i in range(n - 1):
			[x, y] = li(lag=-1)
			children[x].append(y)
			children[y].append(x)
	else:
		for i in range(n - 1):
			[x, y, w] = li(lag=-1)
			w += 1
			children[x].append([y, w])
			children[y].append([x, w])
	return children

def dist(tree, n, A, B=-1):
	s = [[A, 0]]
	(massimo, massimo_nodo) = (0, 0)
	distanza = -1
	v = [-1] * n
	while s:
		(el, dis) = s.pop()
		if dis > massimo:
			massimo = dis
			massimo_nodo = el
		if el == B:
			distanza = dis
		for child in tree[el]:
			if v[child] == -1:
				v[child] = 1
				s.append([child, dis + 1])
	return (massimo, massimo_nodo, distanza)

def diameter(tree):
	(_, foglia, _) = dist(tree, n, 0)
	(diam, _, _) = dist(tree, n, foglia)
	return diam

def dfs(graph, n, A):
	v = [-1] * n
	s = [[A, 0]]
	v[A] = 0
	while s:
		(el, dis) = s.pop()
		for child in graph[el]:
			if v[child] == -1:
				v[child] = dis + 1
				s.append([child, dis + 1])
	return v

def bfs(graph, n, A):
	v = [-1] * n
	s = deque()
	s.append([A, 0])
	v[A] = 0
	while s:
		(el, dis) = s.popleft()
		for child in graph[el]:
			if v[child] == -1:
				v[child] = dis + 1
				s.append([child, dis + 1])
	return v

def parents_children_root_unrooted_tree(tree, n, root=0):
	q = deque()
	visited = [0] * n
	parent = [-1] * n
	children = [[] for i in range(n)]
	q.append(root)
	while q:
		all_done = 1
		visited[q[0]] = 1
		for child in tree[q[0]]:
			if not visited[child]:
				all_done = 0
				q.appendleft(child)
		if all_done:
			for child in tree[q[0]]:
				if parent[child] == -1:
					parent[q[0]] = child
					children[child].append(q[0])
			q.popleft()
	return (parent, children)

def all_longest_path_passing_from_node(parent, children, n):
	q = deque()
	visited = [len(children[i]) for i in range(n)]
	downwards = [[0, 0] for i in range(n)]
	upward = [1] * n
	longest_path = [1] * n
	for i in range(n):
		if not visited[i]:
			q.append(i)
			downwards[i] = [1, 0]
	while q:
		node = q.popleft()
		if parent[node] != -1:
			visited[parent[node]] -= 1
			if not visited[parent[node]]:
				q.append(parent[node])
		else:
			root = node
		for child in children[node]:
			downwards[node] = sorted([downwards[node][0], downwards[node][1], downwards[child][0] + 1], reverse=True)[0:2]
	s = [node]
	while s:
		node = s.pop()
		if parent[node] != -1:
			if downwards[parent[node]][0] == downwards[node][0] + 1:
				upward[node] = 1 + max(upward[parent[node]], downwards[parent[node]][1])
			else:
				upward[node] = 1 + max(upward[parent[node]], downwards[parent[node]][0])
		longest_path[node] = downwards[node][0] + downwards[node][1] + upward[node] - min([downwards[node][0], downwards[node][1], upward[node]]) - 1
		for child in children[node]:
			s.append(child)
	return longest_path
(n1, n2, n3) = li()
a = [sorted(li()), sorted(li()), sorted(li())]
m = []
for i in range(3):
	m.append([a[i][0], len(a[i]), sum(a[i]), i])
s = sum(a[0]) + sum(a[1]) + sum(a[2])
m.sort()
if m[0][1] == 1:
	tot = s - 2 * m[0][0]
elif m[1][1] == 1:
	tot = s - 2 * m[1][0]
elif m[2][1] == 1:
	minimi = min(m[0][0] + m[1][0], m[2][0])
	tot = s - 2 * minimi
else:
	tot = s - 2 * m[0][0] - 2 * m[1][0]
tot1 = s - 2 * sum(a[0])
tot2 = s - 2 * sum(a[1])
tot3 = s - 2 * sum(a[2])
print(max(tot, tot1, tot2, tot3))


from sys import stdin
(n1, n2, n3) = map(int, stdin.readline().split())
arr1 = list(map(int, stdin.readline().split()))
arr2 = list(map(int, stdin.readline().split()))
arr3 = list(map(int, stdin.readline().split()))
di = []
for i in range(n1):
	di.append((arr1[i], 1))
for i in range(n2):
	di.append((arr2[i], 2))
for i in range(n3):
	di.append((arr3[i], 3))
mp = set()
counter = 0
c = [0, 0, 0]
for i in sorted(di, key=lambda x: x[0]):
	mp.add(i[1])
	if len(mp) > 2 and counter == 2:
		c[2] = i[0]
		break
	elif counter == 1 and len(mp) == 2:
		c[1] = i[0]
		counter += 1
	elif counter == 0 and len(mp) == 1:
		c[0] = i[0]
		counter += 1
c.sort()
print(sum(arr1) + sum(arr2) + sum(arr3) - 2 * min(c[0] + c[1], sum(arr1), sum(arr2), sum(arr3)))


(n1, n2, n3) = map(int, input().split())
val = []

def func(a, b, c, d, e, f):
	dd = d - a[0]
	v1 = b[0] - dd
	ff = f - c[-1]
	v2 = a[0] - ff - (e - b[0])
	if v1 < 0:
		return c[-1] - v1 - v2
	else:
		v2 -= v1
		return c[-1] - v2
one = list(map(int, input().split()))
two = list(map(int, input().split()))
three = list(map(int, input().split()))
one.sort()
two.sort()
three.sort()
os = sum(one)
ts = sum(two)
ths = sum(three)
li = []
li.append(func(one, two, three, os, ts, ths))
li.append(func(one, three, two, os, ths, ts))
li.append(func(two, three, one, ts, ths, os))
li.append(func(two, one, three, ts, os, ths))
li.append(func(three, one, two, ths, os, ts))
li.append(func(three, two, one, ths, ts, os))
print(max(li))


from sys import stdin, stdout
(x, y, z) = list(map(int, stdin.readline().split()))
a = sorted(list(map(int, stdin.readline().split())))
b = sorted(list(map(int, stdin.readline().split())))
c = sorted(list(map(int, stdin.readline().split())))
l = []
s = sum(a) + sum(b) + sum(c)
(d, e, f) = (min(a), min(b), min(c))
an = s - 2 * min(d + e, e + f, f + d)
t = 2 * min(sum(a), sum(b), sum(c))
print(max(an, s - t))


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
import copy
import time
starttime = time.time()
mod = int(pow(10, 9) + 7)
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def L():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
try:
	sys.stdin = open('input.txt', 'r')
except:
	pass

def pmat(A):
	for ele in A:
		print(*ele, end='\n')
(a, b, c) = L()
A = L()
B = L()
C = L()
(a, b, c) = (sum(A), sum(B), sum(C))
(ma, mb, mc) = (min(A), min(B), min(C))
print(a + b + c - 2 * min(a, b, c, ma + mb, mb + mc, ma + mc))
endtime = time.time()


(aa, bb, cc) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
ss = [sum(a), sum(b), sum(c)]
ss.sort()
s = ss[1] + ss[2] - ss[0]
dd = [min(a), min(b), min(c)]
dd.sort()
print(max(s, sum(ss) - 2 * (dd[0] + dd[1])))


import sys
input = sys.stdin.readline
import math
import copy
import collections
from collections import deque
(n1, n2, n3) = map(int, input().split())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a3 = list(map(int, input().split()))
a1.sort()
a2.sort()
a3.sort()
ans1 = sum(a1[1:]) + sum(a2[1:]) + sum(a3[1:]) - a1[0] - a2[0] - a3[0] + 2 * max(a1[0], a2[0], a3[0])
ans2 = -2 * min([sum(a1), sum(a2), sum(a3)]) + sum([sum(a1), sum(a2), sum(a3)])
print(max(ans1, ans2))


from math import *
from sys import *
(n1, n2, n3) = map(int, stdin.readline().split())
a = list(map(int, stdin.readline().split()))
b = list(map(int, stdin.readline().split()))
c = list(map(int, stdin.readline().split()))
m = []
s = []
x = 0
y = 10 ** 9 + 9
for i in range(len(a)):
	x += a[i]
	y = min(a[i], y)
s.append(x)
m.append(y)
x = 0
y = 10 ** 9 + 9
for i in range(len(b)):
	x += b[i]
	y = min(b[i], y)
s.append(x)
m.append(y)
x = 0
y = 10 ** 9 + 9
for i in range(len(c)):
	x += c[i]
	y = min(c[i], y)
s.append(x)
m.append(y)
s.sort()
m.sort()
s = sum(s) - 2 * min(m[0] + m[1], s[0])
print(s)


(n1, n2, n3) = list(map(int, input().split()))
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a3 = list(map(int, input().split()))
(s1, s2, s3) = (sum(a1), sum(a2), sum(a3))
b = [sum(sorted([min(*list(a1 + [a1[0]])), min(*list(a2 + [a2[0]])), min(*list(a3 + [a3[0]]))])[:2]), s1, s2, s3]
print(s1 + s2 + s3 - 2 * min(*b))


(n1, n2, n3) = map(int, input().split())
a = sorted(list(map(int, input().split())))
b = sorted(list(map(int, input().split())))
c = sorted(list(map(int, input().split())))
s = sum(a) + sum(b) + sum(c)
minn = 10 ** 18
minn = min(minn, a[0] + min(b[0], c[0]), sum(a))
minn = min(minn, b[0] + min(a[0], c[0]), sum(b))
minn = min(minn, c[0] + min(a[0], b[0]), sum(c))
print(s - 2 * minn)


def sol(first, second, third):
	first = [int(i) for i in first]
	second = [int(i) for i in second]
	third = [int(i) for i in third]
	f_sum = sum(first)
	s_sum = sum(second)
	t_sum = sum(third)
	arr_min = min(f_sum, s_sum, t_sum)
	f_min = min(first)
	s_min = min(second)
	t_min = min(third)
	gen_min = min(f_min + s_min, s_min + t_min, f_min + t_min, arr_min)
	return f_sum + s_sum + t_sum - 2 * gen_min
general = input()
first = input().split()
second = input().split()
third = input().split()
print(sol(first, second, third))


(n1, n2, n3) = [int(x) for x in input().split()]
a1 = [int(x) for x in input().split()]
a2 = [int(x) for x in input().split()]
a3 = [int(x) for x in input().split()]
s1 = sum(a1)
s2 = sum(a2)
s3 = sum(a3)
m1 = min(a1)
m2 = min(a2)
m3 = min(a3)
m = m1 + m2 + m3 - max(m1, m2, m3)
ans = s1 + s2 + s3 - 2 * min(s1, s2, s3, m)
print(ans)


def three(a1, a2, a3):
	temp = [a1, a2, a3]
	ans = 0
	temp = sorted(temp, key=lambda s: s[0])
	c1 = sum(temp[1][1:]) + sum(temp[2]) - temp[0][0]
	c2 = temp[1][0] - sum(temp[0][1:])
	ans = max(ans, abs(c1) + abs(c2))
	s = sum(a1) + sum(a2) + sum(a3)
	for i in range(0, 3):
		ans = max(ans, s - 2 * sum(temp[i]))
	return ans
a = input()
l1 = sorted(list(map(int, input().strip().split())))
l2 = sorted(list(map(int, input().strip().split())))
l3 = sorted(list(map(int, input().strip().split())))
print(three(l1, l2, l3))


input()
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
ma = min(a)
mb = min(b)
mc = min(c)
print(sum(a) + sum(b) + sum(c) - min(ma + mb, ma + mc, mb + mc, sum(a), sum(b), sum(c)) * 2)


(n, m, k) = [int(a) for a in input().split()]
ar = list(map(int, input().split()))[:n]
b = list(map(int, input().split()))[:m]
c = list(map(int, input().split()))[:k]
L = [min(ar), min(b), min(c)]
L.sort()
s = sum(ar) + sum(b) + sum(c) - 2 * min(sum(ar), sum(b), sum(c), L[0] + L[1])
print(s)


(n1, n2, n3) = map(int, input().split())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
l3 = list(map(int, input().split()))
l1.sort()
l2.sort()
l3.sort()
l = [l1[0], l2[0], l3[0]]
l.sort()
s1 = sum(l1)
s2 = sum(l2)
s3 = sum(l3)
s = s1 + s2 + s3
ans = max(s - 2 * (l[0] + l[1]), s - 2 * s1, s - 2 * s2, s - 2 * s3)
print(ans)


import sys
input = sys.stdin.readline
(n1, n2, n3) = map(int, input().strip().split(' '))
a1 = list(map(int, input().strip().split(' ')))
a2 = list(map(int, input().strip().split(' ')))
a3 = list(map(int, input().strip().split(' ')))
m1 = min(a1)
m2 = min(a2)
m3 = min(a3)
mx = m1 + m2 + m3 - max(m1, m2, m3)
print(sum(a1 + a2 + a3) - 2 * min(sum(a1), sum(a2), sum(a3), mx))


from sys import stdin
import sys
tt = 1
for loop in range(tt):
	(n1, n2, n3) = map(int, stdin.readline().split())
	a1 = list(map(int, stdin.readline().split()))
	a2 = list(map(int, stdin.readline().split()))
	a3 = list(map(int, stdin.readline().split()))
	(m1, m2, m3) = (min(a1), min(a2), min(a3))
	(s1, s2, s3) = (sum(a1), sum(a2), sum(a3))
	s = s1 + s2 + s3
	ans = max(s1 + s2 - s3, s2 + s3 - s1, s1 + s3 - s2)
	ans = max(ans, s - 2 * (m1 + m2), s - 2 * (m1 + m3), s - 2 * (m2 + m3))
	print(ans)


import os
import sys
from io import BytesIO, IOBase
import math
from collections import defaultdict, deque
from itertools import combinations
import random
BUFSIZE = 8192
MOD = pow(10, 9) + 7

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
l = list(map(int, input().split(' ')))
a = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))
c = list(map(int, input().split(' ')))
(d, e, f) = (sum(a), sum(b), sum(c))
(x, y, z) = (min(a), min(b), min(c))
print(d + e + f - 2 * min((x + y, y + z, z + x, d, e, f)))


import sys, os, io
import time
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
(n1, n2, n3) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
m1 = min(a)
m2 = min(b)
m3 = min(c)
fm = min(m1 + m2, m2 + m3, m1 + m3)
nnn = a + b + c
tans = sum(nnn) - 2 * fm
nm = min(sum(a), sum(b), sum(c))
total = sum(a + b + c)
ans = max(tans, total - 2 * nm)
print(ans)


(n1, n2, n3) = map(int, input().split())
(l1, l2, l3) = (list(map(int, input().split())), list(map(int, input().split())), list(map(int, input().split())))
s = sum(l1) + sum(l2) + sum(l3)
(m1, m2, m3) = (max(l1), max(l2), max(l3))
(q1, q2, q3) = (min(l1), min(l2), min(l3))
print(max(s - 2 * min(sum(l1), sum(l2), sum(l3)), s - q1 - q2 - q3 + 2 * max(q1, q2, q3) - sum([q1, q2, q3])))


s = input().split()
n = [int(s[i]) for i in range(3)]
s = input().split()
A = [int(s[i]) for i in range(n[0])]
s = input().split()
B = [int(s[i]) for i in range(n[1])]
s = input().split()
C = [int(s[i]) for i in range(n[2])]
(a, b, c) = (min(A), min(B), min(C))
(sa, sb, sc) = (sum(A), sum(B), sum(C))
sm = sa + sb + sc
P = []
P.append(sm - 2 * (a + b))
P.append(sm - 2 * (b + c))
P.append(sm - 2 * (a + c))
P.append(sm - 2 * sb)
P.append(sm - 2 * sc)
P.append(sm - 2 * sa)
print(max(P))


(n1, n2, n3) = tuple([int(x) for x in input().split()])
nums = []
for i in range(3):
	nums.append([int(x) for x in input().split()])
sums = [0, 0, 0]
mins = [0, 0, 0]
for i in range(3):
	nums[i] = sorted(nums[i])
	sums[i] = sum(nums[i])
	mins[i] = min(nums[i])
global_min = min([(mins[i], sums[i], i) for i in range(3)])
second_global_min = min([(mins[i], sums[i], i) for i in range(3) if i != global_min[2]])
choices = [(0, 1), (1, 2), (0, 2), (0,), (1,), (2,)]
max_result = 0
all_sum = sum(sums)
for choice in choices:
	if len(choice) == 2:
		cur_result = all_sum - 2 * (mins[choice[0]] + mins[choice[1]])
		if cur_result > max_result:
			max_result = cur_result
	elif len(choice) == 1:
		cur_result = all_sum - 2 * sums[choice[0]]
		if cur_result > max_result:
			max_result = cur_result
print(max_result)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from functools import cmp_to_key
from heapq import *
from math import gcd, factorial, floor, ceil, sqrt
from copy import deepcopy
from collections import deque
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def testcase(t):
	for pp in range(t):
		solve(pp)

def google(p):
	print('Case #' + str(p) + ': ', end='')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(x, y, p):
	y %= p - 1
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
inf = pow(10, 20)
mod = 10 ** 9 + 7

def solve(case):
	n = lis()
	a1 = lis()
	a2 = lis()
	a3 = lis()
	m1 = min(a1)
	s1 = sum(a1)
	m2 = min(a2)
	s2 = sum(a2)
	m3 = min(a3)
	s3 = sum(a3)
	a = [m1, m2, m3]
	b = [s1, s2, s3]
	a = sorted(a)
	b = sorted(b)[::-1]
	help = a1 + a2 + a3
	ans = b[0] + b[1] - b[2]
	print(max(ans, sum(help) - 2 * sum(a[:2])))
testcase(1)


ch = input()
L = [int(i) for i in ch.split()]
(n1, n2, n3) = (L[0], L[1], L[2])
ch = input()
L1 = [int(i) for i in ch.split()]
L1.sort()
ch = input()
L2 = [int(i) for i in ch.split()]
L2.sort()
ch = input()
L3 = [int(i) for i in ch.split()]
L3.sort()
L = L1 + L2 + L3
d = min(L1[0] + L2[0], L2[0] + L3[0])
d = min(d, L1[0] + L3[0])
d = min(d, sum(L1))
d = min(d, sum(L2))
d = min(d, sum(L3))
print(sum(L) - 2 * d)


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def st():
	return input().rstrip('\n')

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

def ma():
	return map(int, input().split())
t = 1
while t:
	t -= 1
	(n, m, k) = ma()
	a = lis()
	b = lis()
	c = lis()
	x = sum(a) + sum(b) + sum(c)
	(s, s1, s2) = (min(a), min(b), min(c))
	print(x - 2 * min(s + s1, s + s2, s1 + s2, sum(a), sum(b), sum(c)))


import sys
input = sys.stdin.readline
(n1, n2, n3) = map(int, input().split())
a = []
for i in range(3):
	a.append(list(map(int, input().split())))
for i in range(3):
	a[i].sort()
ans = -float('inf')
for i in range(3):
	x = i
	y = (i + 1) % 3
	z = (i - 1) % 3
	curr = sum(a[x])
	ys = sum(a[y])
	zs = sum(a[z])
	k = ys + zs
	curr += k
	curr -= min(2 * ys, 2 * zs, 2 * (a[y][0] + a[z][0]))
	ans = max(ans, curr)
print(ans)


import sys
import math
from bisect import bisect_right as br
from statistics import mode
from itertools import combinations as cb

def int_arr():
	return list(map(int, sys.stdin.readline().strip().split()))

def str_arr():
	return list(map(str, sys.stdin.readline().strip().split()))

def input():
	return sys.stdin.readline().strip()
(n, m, k) = int_arr()
a = int_arr()
b = int_arr()
c = int_arr()
ma = min(a)
mb = min(b)
mc = min(c)
print(sum(a) + sum(b) + sum(c) - min(ma + mb, ma + mc, mb + mc, sum(a), sum(b), sum(c)) * 2)


import sys
from bisect import bisect_left as lb
from bisect import bisect_right as rb
from collections import deque
from queue import PriorityQueue as pq
from math import gcd
input_ = lambda : sys.stdin.readline().strip('\r\n')
ii = lambda : int(input_())
il = lambda : list(map(int, input_().split()))
ilf = lambda : list(map(float, input_().split()))
lii = lambda : list(map(int, list(ip())))
ip = lambda : input_()
fi = lambda : float(input_())
ap = lambda ab, bc, cd: ab[bc].append(cd)
li = lambda : list(input_())
pr = lambda x: print(x)
prinT = lambda x: print(x)
f = lambda : sys.stdout.flush()
inv = lambda x: pow(x, mod - 2, mod)
dx = [0, 0, 1, -1]
dy = [1, -1, 0, 0]
mod = 10 ** 9 + 7
mod1 = 998244353
(n1, n2, n3) = il()
a = il()
b = il()
c = il()
print(sum(a) + sum(b) + sum(c) - 2 * min(sum(a), sum(b), sum(c), min(a) + min(b), min(b) + min(c), min(c) + min(a)))


import sys
zz = 1
sys.setrecursionlimit(10 ** 5)
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')
di = [[-1, 0], [1, 0], [0, 1], [0, -1]]

def fori(n):
	return [fi() for i in range(n)]

def inc(d, c, x=1):
	d[c] = d[c] + x if c in d else x

def ii():
	return input().rstrip()

def li():
	return [int(xx) for xx in input().split()]

def fli():
	return [float(x) for x in input().split()]

def comp(a, b):
	if a > b:
		return 2
	return 2 if a == b else 0

def gi():
	return [xx for xx in input().split()]

def gtc(tc, ans):
	print('Case #' + str(tc) + ':', ans)

def cil(n, m):
	return n // m + int(n % m > 0)

def fi():
	return int(input())

def pro(a):
	return reduce(lambda a, b: a * b, a)

def swap(a, i, j):
	(a[i], a[j]) = (a[j], a[i])

def si():
	return list(input().rstrip())

def mi():
	return map(int, input().split())

def gh():
	sys.stdout.flush()

def isvalid(i, j, n, m):
	return 0 <= i < n and 0 <= j < m

def bo(i):
	return ord(i) - ord('a')

def graph(n, m):
	for i in range(m):
		(x, y) = mi()
		a[x].append(y)
		a[y].append(x)
t = 1
while t > 0:
	t -= 1
	(n, m, k) = mi()
	a = li()
	b = li()
	c = li()
	s = sum(a) + sum(b) + sum(c)
	a = [a, b, c]
	ans = -10 ** 18
	for i in range(3):
		for j in range(3):
			if i == j:
				if len(a[i]) != 2:
					continue
				ans = max(ans, s - 2 * sum(a[i]))
			else:
				ans = max(ans, s - 2 * min(a[i]) - 2 * min(a[j]))
				ans = max(ans, s - 2 * sum(a[i]))
	print(ans)


(a, b, c) = map(int, input().split())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
l3 = list(map(int, input().split()))
sum1 = sum(l1 + l2 + l3)
mn1 = min(l1)
mn2 = min(l2)
mn3 = min(l3)
mn = min(mn1 + mn2, min(mn1 + mn3, mn2 + mn3))
sum_min = min(sum(l1), min(sum(l2), sum(l3)))
ans = min(mn, sum_min)
print(sum1 - ans * 2)


(n1, n2, n3) = map(int, input().split())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
l3 = list(map(int, input().split()))
s = []
s1 = sum(l1)
s2 = sum(l2)
s3 = sum(l3)
s.append(s1)
s.append(s2)
s.append(s3)
mi = []
m1 = min(l1)
m2 = min(l2)
m3 = min(l3)
mi.append(m1)
mi.append(m2)
mi.append(m3)
su = s1 + s2 + s3
x = min(min(mi[0] + mi[1], mi[1] + mi[2]), mi[0] + mi[2])
ans = su - 2 * x
x = min(s[0], min(s[1], s[2]))
ans = max(ans, su - 2 * x)
print(ans)


(n1, n2, n3) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
suma = sum(a)
sumb = sum(b)
sumc = sum(c)
ma = min(a)
mb = min(b)
mc = min(c)
ans = suma + sumb + sumc - 2 * min(ma + mb + mc - max(ma, mb, mc), min(suma, sumb, sumc))
print(ans)


(z, s, m) = (lambda : list(map(int, input().split())), sum, min)
(_, a, b, c) = (z(), z(), z(), z())
(u, v, w, x, y, z) = (s(a), s(b), s(c), m(a), m(b), m(c))
print(u + v + w - 2 * m(u, v, w, x + y, y + z, x + z))


import os, sys
from io import BytesIO, IOBase

def main():
	(n1, n2, n3) = map(int, input().split())
	a1 = list(map(int, input().split()))
	a2 = list(map(int, input().split()))
	a3 = list(map(int, input().split()))
	(s1, s2, s3) = (sum(a1), sum(a2), sum(a3))
	ans = s1 + s2 + s3 - 2 * min(s1, s2, s3)
	x = s1 + s2 + s3
	(m1, m2, m3) = (min(a1), min(a2), min(a3))
	print(max(ans, x - 2 * min(m1 + m2, m1 + m3, m2 + m3)))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from sys import stdin, stdout
input = stdin.readline

def output(answer):
	stdout.write(str(answer) + '\n')
(na, nb, nc) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
(sa, ma) = (sum(a), min(a))
(sb, mb) = (sum(b), min(b))
(sc, mc) = (sum(c), min(c))
mx = 0
first = sb + sc
sub = abs(sa - ma - min(mb, mc)) - min(mb, mc) - ma
first += sub
second = sa + sc
sub = abs(sb - mb - min(ma, mc)) - min(ma, mc) - mb
second += sub
third = sa + sb
sub = abs(sc - mc - min(mb, ma)) - min(mb, ma) - mc
third += sub
output(max(first, second, third))


import math
import random
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
from collections import defaultdict
mod = 10 ** 9 + 7
mod1 = 998244353
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class TreeNode:

	def __init__(self, k, v):
		self.key = k
		self.value = v
		self.left = None
		self.right = None
		self.parent = None
		self.height = 1
		self.num_left = 1
		self.num_total = 1

class AvlTree:

	def __init__(self):
		self._tree = None

	def add(self, k, v):
		if not self._tree:
			self._tree = TreeNode(k, v)
			return
		node = self._add(k, v)
		if node:
			self._rebalance(node)

	def _add(self, k, v):
		node = self._tree
		while node:
			if k < node.key:
				if node.left:
					node = node.left
				else:
					node.left = TreeNode(k, v)
					node.left.parent = node
					return node.left
			elif node.key < k:
				if node.right:
					node = node.right
				else:
					node.right = TreeNode(k, v)
					node.right.parent = node
					return node.right
			else:
				node.value = v
				return

	@staticmethod
	def get_height(x):
		return x.height if x else 0

	@staticmethod
	def get_num_total(x):
		return x.num_total if x else 0

	def _rebalance(self, node):
		n = node
		while n:
			lh = self.get_height(n.left)
			rh = self.get_height(n.right)
			n.height = max(lh, rh) + 1
			balance_factor = lh - rh
			n.num_total = 1 + self.get_num_total(n.left) + self.get_num_total(n.right)
			n.num_left = 1 + self.get_num_total(n.left)
			if balance_factor > 1:
				if self.get_height(n.left.left) < self.get_height(n.left.right):
					self._rotate_left(n.left)
				self._rotate_right(n)
			elif balance_factor < -1:
				if self.get_height(n.right.right) < self.get_height(n.right.left):
					self._rotate_right(n.right)
				self._rotate_left(n)
			else:
				n = n.parent

	def _remove_one(self, node):
		replacement = node.left or node.right
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = replacement
			else:
				node.parent.right = replacement
			replacement.parent = node.parent
			node.parent = None
		else:
			self._tree = replacement
			replacement.parent = None
		node.left = None
		node.right = None
		node.parent = None
		self._rebalance(replacement)

	def _remove_leaf(self, node):
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = None
			else:
				node.parent.right = None
			self._rebalance(node.parent)
		else:
			self._tree = None
		node.parent = None
		node.left = None
		node.right = None

	def remove(self, k):
		node = self._get_node(k)
		if not node:
			return
		if AvlTree._is_leaf(node):
			self._remove_leaf(node)
			return
		if node.left and node.right:
			nxt = AvlTree._get_next(node)
			node.key = nxt.key
			node.value = nxt.value
			if self._is_leaf(nxt):
				self._remove_leaf(nxt)
			else:
				self._remove_one(nxt)
			self._rebalance(node)
		else:
			self._remove_one(node)

	def get(self, k):
		node = self._get_node(k)
		return node.value if node else -1

	def _get_node(self, k):
		if not self._tree:
			return None
		node = self._tree
		while node:
			if k < node.key:
				node = node.left
			elif node.key < k:
				node = node.right
			else:
				return node
		return None

	def get_at(self, pos):
		x = pos + 1
		node = self._tree
		while node:
			if x < node.num_left:
				node = node.left
			elif node.num_left < x:
				x -= node.num_left
				node = node.right
			else:
				return (node.key, node.value)
		raise IndexError('Out of ranges')

	@staticmethod
	def _is_left(node):
		return node.parent.left and node.parent.left == node

	@staticmethod
	def _is_leaf(node):
		return node.left is None and node.right is None

	def _rotate_right(self, node):
		if not node.parent:
			self._tree = node.left
			node.left.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.left
			node.left.parent = node.parent
		else:
			node.parent.right = node.left
			node.left.parent = node.parent
		bk = node.left.right
		node.left.right = node
		node.parent = node.left
		node.left = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	def _rotate_left(self, node):
		if not node.parent:
			self._tree = node.right
			node.right.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.right
			node.right.parent = node.parent
		else:
			node.parent.right = node.right
			node.right.parent = node.parent
		bk = node.right.left
		node.right.left = node
		node.parent = node.right
		node.right = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	@staticmethod
	def _get_next(node):
		if not node.right:
			return node.parent
		n = node.right
		while n.left:
			n = n.left
		return n

class SegmentTree1:

	def __init__(self, data, default=300006, func=lambda a, b: min(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

def powm(a, n, m):
	if a == 1 or n == 0:
		return 1
	if n % 2 == 0:
		s = powm(a, n // 2, m)
		return s * s % m
	else:
		return a * powm(a, n - 1, m) % m

def sort_list(list1, list2):
	zipped_pairs = zip(list2, list1)
	z = [x for (_, x) in sorted(zipped_pairs)]
	return z

def product(l):
	por = 1
	for i in range(len(l)):
		por *= l[i]
	return por

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] < key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def binary(x, length):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y

def countGreater(arr, n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if arr[m] >= k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
	return n - leftGreater

class TrieNode:

	def __init__(self):
		self.children = [None] * 26
		self.isEndOfWord = False

class Trie:

	def __init__(self):
		self.root = self.getNode()

	def getNode(self):
		return TrieNode()

	def _charToIndex(self, ch):
		return ord(ch) - ord('a')

	def insert(self, key):
		pCrawl = self.root
		length = len(key)
		for level in range(length):
			index = self._charToIndex(key[level])
			if not pCrawl.children[index]:
				pCrawl.children[index] = self.getNode()
			pCrawl = pCrawl.children[index]
		pCrawl.isEndOfWord = True

	def search(self, key):
		pCrawl = self.root
		length = len(key)
		for level in range(length):
			index = self._charToIndex(key[level])
			if not pCrawl.children[index]:
				return False
			pCrawl = pCrawl.children[index]
		return pCrawl != None and pCrawl.isEndOfWord

class Node:

	def __init__(self, data):
		self.data = data
		self.height = 0
		self.left = None
		self.right = None

class BinaryTrie:

	def __init__(self):
		self.root = Node(0)

	def insert(self, pre_xor):
		self.temp = self.root
		for i in range(31, -1, -1):
			val = pre_xor & 1 << i
			if val == 0:
				if not self.temp.right:
					self.temp.right = Node(0)
				self.temp = self.temp.right
			elif val >= 1:
				if not self.temp.left:
					self.temp.left = Node(0)
				self.temp = self.temp.left

	def do(self, temp):
		if not temp:
			return 0
		ter = temp
		temp.height = self.do(ter.left) + self.do(ter.right)
		if temp.height == 0:
			temp.height += 1
		return temp.height

	def query(self, xor):
		self.temp = self.root
		cur = 0
		i = 31
		while i > -1:
			val = xor & 1 << i
			if not self.temp:
				return cur
			if val >= 1:
				self.opp = self.temp.right
				if self.temp.left:
					self.temp = self.temp.left
				else:
					return cur
			else:
				self.opp = self.temp.left
				if self.temp.right:
					self.temp = self.temp.right
				else:
					return cur
			if self.temp.height == pow(2, i):
				cur += 1 << i
				self.temp = self.opp
			i -= 1
		return cur
for ik in range(1):
	(n, m, k) = map(int, input().split())
	l = list(map(int, input().split()))
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	l.sort()
	l1.sort()
	l2.sort()
	w = min(l[0] + l1[0], l[0] + l2[0], l1[0] + l2[0], sum(l), sum(l1), sum(l2))
	sw = min(l[0], l1[0], l2[0])
	s = sum(l)
	s1 = sum(l1)
	s2 = sum(l2)
	ans = s + s1 + s2 - 2 * w
	e = 0
	print(ans + e)


from sys import stdin, stdout
import math, bisect, heapq
from collections import Counter, deque, defaultdict
L = lambda : list(map(int, stdin.readline().strip().split()))
I = lambda : int(stdin.readline().strip())
S = lambda : stdin.readline().strip()
C = lambda : stdin.readline().strip().split()

def pr(a):
	print(''.join(list(map(str, a))))

def solve():
	(x, y, z) = L()
	a = L()
	b = L()
	c = L()
	l = [min(a), min(b), min(c)]
	l.sort()
	print(sum(a) + sum(b) + sum(c) - 2 * min(sum(a), sum(b), sum(c), l[0] + l[1]))
for _ in range(1):
	solve()


from sys import stdin, stdout
from math import gcd, sqrt, factorial, pi, inf
from collections import deque, defaultdict
from bisect import bisect, bisect_left
from itertools import permutations as per
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
L = lambda : list(R())
P = lambda x: stdout.write(str(x) + '\n')
nCr = lambda x, y: f[x] * inv(f[y] * f[x - y] % N) % N
inv = lambda x: pow(x, N - 2, N)
lcm = lambda x, y: x * y // gcd(x, y)
hg = lambda x, y: (y + x - 1) // x * x
pw = lambda x: 1 if x == 1 else 1 + pw(x // 2)
chk = lambda x: chk(x // 2) if not x % 2 else True if x == 1 else False
sm = lambda x: (x ** 2 + x) // 2
N = 10 ** 9 + 7
(x, y, z) = R()
(a, b, c) = (L(), L(), L())
v = sorted([[min(a), sum(a)], [min(b), sum(b)], [min(c), sum(c)]], key=lambda x: x[0])
print(sum([i[1] for i in v]) - 2 * min(v[0][1], v[0][0] + v[1][0], v[2][1], v[1][1]))


input()
f = []
g = []
for i in range(3):
	arr = list(map(int, input().split()))
	f.append(sum(arr))
	g.append(min(arr))
f.sort()
g.sort()
print(sum(f) - 2 * min(g[0] + g[1], f[0]))


input()
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a3 = list(map(int, input().split()))
asums = [sum(a) for a in [a1, a2, a3]]
amins = [min(a) for a in [a1, a2, a3]]
totalSum = sum(asums)
candidates = [min(asums), sum(amins) - max(amins)]
print(totalSum - 2 * min(candidates))


(n1, n2, n3) = map(int, input().split())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a3 = list(map(int, input().split()))
print(sum(a1 + a2 + a3) - 2 * min(min(sum(a1), sum(a2), sum(a3)), sum(sorted([min(a) for a in [a1, a2, a3]])[0:2])))


import os
import sys
from io import BytesIO, IOBase
import threading
from bisect import bisect_right
from math import gcd, log
from collections import Counter
from pprint import pprint

def main():
	(n1, n2, n3) = map(int, input().split())
	arr = list(map(int, input().split()))
	a = sum(arr)
	am = min(arr)
	brr = list(map(int, input().split()))
	b = sum(brr)
	bm = min(brr)
	crr = list(map(int, input().split()))
	c = sum(crr)
	cm = min(crr)
	s = a + b + c
	ans = 0
	ans = max(ans, s - 2 * a)
	ans = max(ans, s - 2 * (am + min(bm, cm)))
	ans = max(ans, s - 2 * b)
	ans = max(ans, s - 2 * (bm + min(am, cm)))
	ans = max(ans, s - 2 * c)
	ans = max(ans, s - 2 * (cm + min(am, bm)))
	print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(1):
	main()


row = input()
row = row.split(' ')
for i in range(0, 3):
	row[i] = int(row[i])
s = 0
sumRow = 10 ** 18
min1 = 10 ** 18
min2 = 10 ** 18
for i in range(0, 3):
	ss = 0
	minR = 10 ** 18
	t = input()
	t = t.split(' ')
	for j in range(0, row[i]):
		d = int(t[j])
		ss += d
		s += d
		minR = min(minR, d)
	sumRow = min(ss, sumRow)
	if minR <= min1:
		min2 = min1
		min1 = minR
	else:
		min2 = min(min2, minR)
print(s - 2 * min(sumRow, min1 + min2))


def main():
	(n1, n2, n3) = map(int, input().split())
	a1 = list(map(int, input().split()))
	a2 = list(map(int, input().split()))
	a3 = list(map(int, input().split()))
	m1 = min(a1)
	m2 = min(a2)
	m3 = min(a3)
	s1 = sum(a1)
	s2 = sum(a2)
	s3 = sum(a3)
	m = min(m1 + m2, m1 + m3, m2 + m3, s1, s2, s3)
	print(s1 + s2 + s3 - 2 * m)
main()


(n1, n2, n3) = map(int, input().split())
a = [[int(i) for i in input().split()] for j in range(3)]
ans = sum((sum(i) for i in a))
cur = min((sum(i) for i in a))
for i in range(2):
	for j in range(i + 1, 3):
		cur = min(cur, min(a[i]) + min(a[j]))
print(ans - 2 * cur)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import gcd, ceil

def prod(a, mod=10 ** 9 + 7):
	ans = 1
	for each in a:
		ans = ans * each % mod
	return ans

def lcm(a, b):
	return a * b // gcd(a, b)

def binary(x, length=16):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y
for _ in range(int(input()) if not True else 1):
	(n1, n2, n3) = map(int, input().split())
	a = sorted(list(map(int, input().split())))
	b = sorted(list(map(int, input().split())))
	c = sorted(list(map(int, input().split())))
	s = sum(a) + sum(b) + sum(c)
	ans = s - 2 * min(sum(a), sum(b), sum(c))
	print(max(s - 2 * a[0] - 2 * b[0], s - 2 * b[0] - 2 * c[0], s - 2 * a[0] - 2 * c[0], ans))


(na, nb, nc) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
suma = sum(a)
sumb = sum(b)
sumc = sum(c)
mina = min(a)
minb = min(b)
minc = min(c)
ans = -float('inf')
abc = [suma, sumb, sumc]
abc.sort()
(aa, bb, cc) = abc
ans = max(ans, -aa + bb + cc)
abc = [mina, minb, minc]
abc.sort()
(aa, bb, cc) = abc
ans = max(ans, suma + sumb + sumc - aa * 2 - bb * 2)
print(ans)


def brate1(niz1, niz2, niz3):
	niz1.sort()
	niz2.sort()
	niz3.sort()
	kao = [niz1[0], niz2[0], niz3[0]]
	kao2 = [sum(niz1), sum(niz2), sum(niz3)]
	suma = sum(kao2)
	kao2.sort()
	kao.sort()
	suma -= 2 * min(kao[0] + kao[1], kao2[0])
	print(suma)
n = input()
niz1 = input().split(' ')
niz2 = input().split(' ')
niz3 = input().split(' ')
niz1 = [int(i) for i in niz1]
niz2 = [int(i) for i in niz2]
niz3 = [int(i) for i in niz3]
brate1(niz1, niz2, niz3)


import sys, os, io
from math import log, gcd
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
import math

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(int(i))
			n = n / i
	if n > 2:
		l.append(n)
	return list(set(l))

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def si():
	return input()

def prefix_sum(arr):
	r = [0] * (len(arr) + 1)
	for (i, el) in enumerate(arr):
		r[i + 1] = r[i] + el
	return r

def divideCeil(n, x):
	if n % x == 0:
		return n // x
	return n // x + 1

def ii():
	return int(input())

def li():
	return list(map(int, input().split()))
t = 1
for _ in range(t):
	(n1, n2, n3) = li()
	a1 = li()
	a2 = li()
	a3 = li()
	mn = [min(a1), min(a2), min(a3)]
	x = min(mn[0] + mn[1], mn[0] + mn[2], mn[2] + mn[1])
	ans = sum(a1 + a2 + a3) - 2 * x
	x = min(sum(a1), min(sum(a2), sum(a3)))
	ans = max(ans, sum(a1 + a2 + a3) - 2 * x)
	print(ans)


(n1, n2, n3) = map(int, input().split())
l = []
for i in range(3):
	l.append(list(map(int, input().split())))
for i in range(3):
	l[i].sort()
a = []
for i in range(3):
	op = l[i][0]
	s = 0
	for j in range(1, len(l[i])):
		s += l[i][j]
	a.append([op, s])
s = sum([sum(a[i]) for i in range(3)])
ans = 0
for i in range(3):
	for j in range(i + 1, 3):
		ans = max(ans, s - (l[i][0] + l[j][0]) * 2)
	ans = max(ans, s - sum(l[i]) * 2)
print(ans)


from collections import *
import sys
input = sys.stdin.readline

def ri():
	return int(input())

def rl():
	return list(map(int, input().split()))
(n1, n2, n3) = rl()
aa1 = rl()
aa2 = rl()
aa3 = rl()
s1 = sum(aa1)
s2 = sum(aa2)
s3 = sum(aa3)
m1 = min(aa1)
m2 = min(aa2)
m3 = min(aa3)
ans = s1 + s2 + s3 - 2 * min(s1, s2, s3, m1 + m2, m2 + m3, m3 + m1)
print(ans)


import sys
input = sys.stdin.readline
n = list(map(int, input().split()))
bags = []
bags.append(list(map(int, input().split())))
bags.append(list(map(int, input().split())))
bags.append(list(map(int, input().split())))
smallestperlist = [min(bag) for bag in bags]
mintwo = sum(smallestperlist) - max(smallestperlist)
bagsums = [sum(bag) for bag in bags]
minlist = min(bagsums)
best = min(mintwo, minlist)
print(sum(bagsums) - 2 * best)


from sys import stdin, exit
from bisect import bisect_left as bl, bisect_right as br
input = lambda : stdin.readline()[:-1]
intput = lambda : int(input())
sinput = lambda : input().split()
intsput = lambda : map(int, sinput())

def dprint(*args, **kwargs):
	if debugging:
		print(*args, **kwargs)
debugging = 1
(n1, n2, n3) = intsput()
bag1 = list(intsput())
bag2 = list(intsput())
bag3 = list(intsput())
(s1, s2, s3) = (sum(bag1), sum(bag2), sum(bag3))
(m1, m2, m3) = (min(bag1), min(bag2), min(bag3))
smallest = min(s1, s2, s3)
(first, second) = sorted([m1, m2, m3])[:2]
if smallest < first + second:
	print(s1 + s2 + s3 - smallest * 2)
else:
	print(s1 + s2 + s3 - first * 2 - second * 2)


(n1, n2, n3) = [int(v) for v in input().split()]
a1 = [int(v) for v in input().split()]
a2 = [int(v) for v in input().split()]
a3 = [int(v) for v in input().split()]
ma1 = min(a1)
ma2 = min(a2)
ma3 = min(a3)
sa1 = sum(a1)
sa2 = sum(a2)
sa3 = sum(a3)
s = sa1 + sa2 + sa3
print(max(s - 2 * (ma1 + ma2), s - 2 * (ma2 + ma3), s - 2 * (ma3 + ma1), s - 2 * sa1, s - 2 * sa2, s - 2 * sa3))


from sys import stdin
input = stdin.readline
(na, nb, nc) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
sa = sum(a)
sb = sum(b)
sc = sum(c)
l = [min(a), min(b), min(c)]
l.sort()
ans = sa + sb + sc
print(max(ans - 2 * sa, ans - 2 * sb, ans - 2 * sc, ans - (l[0] + l[1]) * 2))


def solve():
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	l3 = list(map(int, input().split()))
	(m1, m2, m3) = (min(l1), min(l2), min(l3))
	(s1, s2, s3) = (sum(l1), sum(l2), sum(l3))
	ans = s1 + s2 + s3 - 2 * min(min(s1, s2, s3), m1 + m2 + m3 - max(m2, m1, m3))
	print(ans)
input().split()
solve()


from sys import stdin
from math import inf
input = lambda : stdin.readline().strip()
ipnut = input
for i in range(1):
	(n1, n2, n3) = map(int, ipnut().split())
	a1 = list(map(int, input().split()))
	a2 = list(map(int, input().split()))
	a3 = list(map(int, input().split()))
	m1 = min(a1)
	m2 = min(a2)
	m3 = min(a3)
	m = [m1, m2, m3]
	m.sort()
	mi = sum(m[:2])
	s1 = sum(a1)
	s2 = sum(a2)
	s3 = sum(a3)
	s = s1 + s2 + s3
	print(s - 2 * min(mi, s1, s2, s3))


from bisect import *
from collections import *
from math import gcd, ceil, sqrt, floor, inf
from heapq import *
from itertools import *
from functools import *
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())
from types import GeneratorType

def bootstrap(f, stack=[]):

	def wrappedfunc(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		else:
			to = f(*args, **kwargs)
			while True:
				if type(to) is GeneratorType:
					stack.append(to)
					to = next(to)
				else:
					stack.pop()
					if not stack:
						break
					to = stack[-1].send(to)
			return to
	return wrappedfunc
mod = 10 ** 9 + 7
farr = [1]
ifa = []

def fact(x, mod=0):
	if mod:
		while x >= len(farr):
			farr.append(farr[-1] * len(farr) % mod)
	else:
		while x >= len(farr):
			farr.append(farr[-1] * len(farr))
	return farr[x]

def ifact(x, mod):
	global ifa
	fact(x, mod)
	ifa.append(pow(farr[-1], mod - 2, mod))
	for i in range(x, 0, -1):
		ifa.append(ifa[-1] * i % mod)
	ifa.reverse()

def per(i, j, mod=0):
	if i < j:
		return 0
	if not mod:
		return fact(i) // fact(i - j)
	return farr[i] * ifa[i - j] % mod

def com(i, j, mod=0):
	if i < j:
		return 0
	if not mod:
		return per(i, j) // fact(j)
	return per(i, j, mod) * ifa[j] % mod

def catalan(n):
	return com(2 * n, n) // (n + 1)

def isprime(n):
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			return False
	return True

def floorsum(a, b, c, n):
	if a == 0:
		return b // c * (n + 1)
	if a >= c or b >= c:
		return floorsum(a % c, b % c, c, n) + b // c * (n + 1) + a // c * n * (n + 1) // 2
	m = (a * n + b) // c
	return n * m - floorsum(c, c - b - 1, a, m - 1)

def lowbit(n):
	return n & -n

def inverse(a, m):
	a %= m
	if a <= 1:
		return a
	return (1 - inverse(m, a) * m) // a % m

class BIT:

	def __init__(self, arr):
		self.arr = arr
		self.n = len(arr) - 1

	def update(self, x, v):
		while x <= self.n:
			self.arr[x] += v
			x += x & -x

	def query(self, x):
		ans = 0
		while x:
			ans += self.arr[x]
			x &= x - 1
		return ans

class DSU:

	def __init__(self, n):
		self.c = [-1] * n

	def same(self, x, y):
		return self.find(x) == self.find(y)

	def find(self, x):
		if self.c[x] < 0:
			return x
		self.c[x] = self.find(self.c[x])
		return self.c[x]

	def union(self, u, v):
		(u, v) = (self.find(u), self.find(v))
		if u == v:
			return False
		if self.c[u] > self.c[v]:
			(u, v) = (v, u)
		self.c[u] += self.c[v]
		self.c[v] = u
		return True

	def size(self, x):
		return -self.c[self.find(x)]

class UFS:

	def __init__(self, n):
		self.parent = [i for i in range(n)]
		self.ranks = [0] * n

	def find(self, x):
		if x != self.parent[x]:
			self.parent[x] = self.find(self.parent[x])
		return self.parent[x]

	def union(self, u, v):
		(pu, pv) = (self.find(u), self.find(v))
		if pu == pv:
			return False
		if self.ranks[pu] >= self.ranks[pv]:
			self.parent[pv] = pu
			if self.ranks[pv] == self.ranks[pu]:
				self.ranks[pu] += 1
		else:
			self.parent[pu] = pv

def Prime(n):
	c = 0
	prime = []
	flag = [0] * (n + 1)
	for i in range(2, n + 1):
		if not flag[i]:
			prime.append(i)
			c += 1
		for j in range(c):
			if i * prime[j] > n:
				break
			flag[i * prime[j]] = prime[j]
			if i % prime[j] == 0:
				break
	return (flag, prime)

def dij(s, graph):
	d = {}
	d[s] = 0
	heap = [(0, s)]
	seen = set()
	while heap:
		(dis, u) = heappop(heap)
		if u in seen:
			continue
		seen.add(u)
		for (v, w) in graph[u]:
			if v not in d or d[v] > d[u] + w:
				d[v] = d[u] + w
				heappush(heap, (d[v], v))
	return d

def GP(it):
	return [[ch, len(list(g))] for (ch, g) in groupby(it)]

def lcm(a, b):
	return a * b // gcd(a, b)

def lis(nums):
	res = []
	for k in nums:
		i = bisect.bisect_left(res, k)
		if i == len(res):
			res.append(k)
		else:
			res[i] = k
	return len(res)

class DLN:

	def __init__(self, val):
		self.val = val
		self.pre = None
		self.next = None

def nb(i, j):
	for (ni, nj) in [[i + 1, j], [i - 1, j], [i, j - 1], [i, j + 1]]:
		if 0 <= ni < n and 0 <= nj < m:
			yield (ni, nj)

@bootstrap
def gdfs(r, p):
	if len(g[r]) == 1 and p != -1:
		yield None
	for ch in g[r]:
		if ch != p:
			yield gdfs(ch, r)
	yield None

def topo(n):
	q = deque()
	res = []
	for i in range(1, n + 1):
		if ind[i] == 0:
			q.append(i)
			res.append(i)
	while q:
		u = q.popleft()
		for v in g[u]:
			ind[v] -= 1
			if ind[v] == 0:
				q.append(v)
				res.append(v)
	return res
t = 1
for i in range(t):
	(n1, n2, n3) = RL()
	a = RLL()
	b = RLL()
	c = RLL()
	sa = sum(a)
	sb = sum(b)
	sc = sum(c)
	(x, y, z) = (min(a), min(b), min(c))
	s = x + y + z - max(x, y, z)
	ans = max(sb + sc - sa, sa + sb - sc, sa + sc - sb, sa + sb + sc - 2 * s)
	print(ans)


(n, m, k) = map(int, input().split())
a = sorted(list(map(int, input().split())))
b = sorted(list(map(int, input().split())))
c = sorted(list(map(int, input().split())))
if max(a[-1], b[-1], c[-1]) == a[-1]:
	tar = 1
elif max(a[-1], b[-1], c[-1]) == b[-1]:
	tar = 2
elif max(a[-1], b[-1], c[-1]) == c[-1]:
	tar = 3
holi = 0
moli = 0
s1 = sum(a)
s2 = sum(b)
s3 = sum(c)
print(max(s1 + s2 + s3 - 2 * min(s1, s2, s3), s1 + s2 + s3 - 2 * (min(a) + min(b) + min(c) - max(min(a), min(b), min(c)))))


import sys
input = sys.stdin.buffer.readline
(na, nb, nc) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
mina = min(a)
minb = min(b)
minc = min(c)
sa = sum(a)
sb = sum(b)
sc = sum(c)
sAll = sa + sb + sc
ans = -float('inf')
ans = max(ans, sc + abs(sa - sb))
ans = max(ans, sAll - 2 * mina - 2 * minb)
(mina, minb, minc) = (minb, minc, mina)
(sa, sb, sc) = (sb, sc, sa)
ans = max(ans, sc + abs(sa - sb))
ans = max(ans, sAll - 2 * mina - 2 * minb)
(mina, minb, minc) = (minb, minc, mina)
(sa, sb, sc) = (sb, sc, sa)
ans = max(ans, sc + abs(sa - sb))
ans = max(ans, sAll - 2 * mina - 2 * minb)
print(ans)


(x, y, z) = 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()
(sum_a, sum_b, sum_c) = (0, 0, 0)
(hsum_a, hsum_b, hsum_c) = (0, 0, 0)
for i in range(x):
	sum_a += a[i]
	if i > 0:
		hsum_a += a[i]
for i in range(y):
	sum_b += b[i]
	if i > 0:
		hsum_b += b[i]
for i in range(z):
	sum_c += c[i]
	if i > 0:
		hsum_c += c[i]
final = 0
ans1 = sum_a
final = max(final, sum_c - sum_b + ans1, sum_b - sum_c + ans1, hsum_b - c[0] + hsum_c - b[0] + ans1)
ans2 = sum_b
final = max(final, sum_c - sum_a + ans2, sum_a - sum_c + ans2, hsum_a - c[0] + hsum_c - a[0] + ans2)
ans3 = sum_c
final = max(final, sum_a - sum_b + ans3, sum_b - sum_a + ans3, hsum_b - a[0] + hsum_a - b[0] + ans3)
print(final)


import sys
input = sys.stdin.readline
import heapq

def solve():
	(n1, n2, n3) = map(int, input().split())
	arr = [sorted(list(map(int, input().split()))) for _ in range(3)]
	S = [sum(nums) for nums in arr]
	q = []
	heapq.heappush(q, (arr[0][0], 0, 0))
	heapq.heappush(q, (arr[1][0], 0, 1))
	heapq.heappush(q, (arr[2][0], 0, 2))
	mv = []
	cnt = s = 0
	while q and cnt < 2:
		(v, i, j) = heapq.heappop(q)
		if not mv:
			cnt += 1
			mv.append((v, i, j))
		elif mv[0][2] == j:
			continue
		elif S[mv[0][2]] >= v + mv[0][0]:
			s = mv[0][0] + v
			cnt += 1
		else:
			s = S[mv[0][2]]
			cnt += 1
		if i == len(arr[j]) - 1:
			continue
		heapq.heappush(q, (arr[j][i + 1], i + 1, j))
	return sum(S) - 2 * min(s, min(S))
print(solve())


from sys import stdin, stdout

def three_bags(n1, n2, n3, a1_a, a2_a, a3_a):
	s1 = sum(a1_a)
	s2 = sum(a2_a)
	s3 = sum(a3_a)
	s = s1 + s2 + s3
	m1 = 1000000000
	m2 = 1000000000
	m3 = 1000000000
	for a1 in a1_a:
		m1 = min(m1, a1)
	for a2 in a2_a:
		m2 = min(m2, a2)
	for a3 in a3_a:
		m3 = min(m3, a3)
	m = min(m1 + m2, m1 + m3, m2 + m3, s1, s2, s3)
	return s - 2 * m
(n1, n2, n3) = map(int, stdin.readline().split())
a1_a = list(map(int, stdin.readline().split()))
a2_a = list(map(int, stdin.readline().split()))
a3_a = list(map(int, stdin.readline().split()))
res = three_bags(n1, n2, n3, a1_a, a2_a, a3_a)
stdout.write(str(res))


(n1, n2, n3) = [int(i) for i in input().split(' ')]
a = [int(i) for i in input().split(' ')]
b = [int(i) for i in input().split(' ')]
c = [int(i) for i in input().split(' ')]
sa = sum(a)
sb = sum(b)
sc = sum(c)
ma = min(a)
mb = min(b)
mc = min(c)
a1 = sa + max(sb + sc - 2 * mb - 2 * mc, abs(sb - sc))
b1 = sb + max(sa + sc - 2 * ma - 2 * mc, abs(sa - sc))
c1 = sc + max(sb + sa - 2 * mb - 2 * ma, abs(sb - sa))
print(max(a1, max(b1, c1)))


import sys

class CThreeBags:

	def solve(self, tc=0):
		n = [int(_) for _ in input().split()]
		arr = []
		arr.append([int(_) for _ in input().split()])
		arr.append([int(_) for _ in input().split()])
		arr.append([int(_) for _ in input().split()])
		for i in range(3):
			arr[i].sort()
		everything = sorted([[x, 0] for (i, x) in enumerate(arr[0])] + [[x, 1] for (i, x) in enumerate(arr[1])] + [[x, 2] for (i, x) in enumerate(arr[2])])
		sm = sum((x[0] for x in everything))
		ans = 0
		if n[0] == 1:
			ans = max(ans, sm - 2 * arr[0][0])
		if n[1] == 1:
			ans = max(ans, sm - 2 * arr[1][0])
		if n[2] == 1:
			ans = max(ans, sm - 2 * arr[2][0])
		mnsm = min((sum(a) for a in arr))
		(u, v) = sorted([arr[0][0], arr[1][0], arr[2][0]])[:2]
		ans = max(ans, sm - 2 * mnsm, sm - 2 * (u + v))
		print(ans)
solver = CThreeBags()
input = sys.stdin.readline
solver.solve()


def read_ints():
	return map(int, input().split(' '))
(n1, n2, n3) = read_ints()
a1 = list(read_ints())
a2 = list(read_ints())
a3 = list(read_ints())
s1 = sum(a1)
s2 = sum(a2)
s3 = sum(a3)
s = s1 + s2 + s3
l1 = min(a1)
l2 = min(a2)
l3 = min(a3)
print(max(s - 2 * min(s1, s2, s3), s - 2 * (l1 + l2 + l3) + 2 * max(l1, l2, l3)))


import collections

def solveTestCase():
	n = [int(i) for i in input().split()]
	a = []
	for i in range(3):
		tmp = [int(i) for i in input().split()]
		a.append(tmp)
	vs = []
	for i in range(3):
		vs.append(sum(a[i]))
	for i in range(3):
		a[i].sort()
	ans = 0
	for i in range(3):
		tmp_ans = vs[i]
		m1 = a[(i + 1) % 3][0]
		s1 = vs[(i + 1) % 3] - m1
		m2 = a[(i + 2) % 3][0]
		s2 = vs[(i + 2) % 3] - m2
		tmp_ans += max(max(s2 + s1 - m1 - m2, s1 + m1 - s2 - m2), s2 + m2 - s1 - m1)
		ans = max(tmp_ans, ans)
	print(ans)
solveTestCase()


(n1, n2, n3) = map(int, input().split())
a1 = [int(x) for x in input().split()]
a2 = [int(x) for x in input().split()]
a3 = [int(x) for x in input().split()]
m1 = min(a1)
m2 = min(a2)
m3 = min(a3)
s1 = sum(a1)
s2 = sum(a2)
s3 = sum(a3)
s = s1 + s2 + s3
best = 0
best = max(best, s - 2 * (m1 + m2))
best = max(best, s - 2 * (m1 + m3))
best = max(best, s - 2 * (m3 + m2))
best = max(best, s - 2 * s1)
best = max(best, s - 2 * s2)
best = max(best, s - 2 * s3)
print(best)


import os
import sys
from io import BytesIO, IOBase
from collections import defaultdict, deque, Counter, OrderedDict
import threading
from heapq import *

def main():
	(x, y, z) = map(int, input().split())
	X = [*map(int, input().split())]
	Y = [*map(int, input().split())]
	Z = [*map(int, input().split())]
	all_sum = sum(X) + sum(Y) + sum(Z)
	(min_x, min_y, min_z) = (min(X), min(Y), min(Z))
	Min = min(min_x + min_y, min_x + min_z, min_y + min_z, sum(X), sum(Y), sum(Z))
	print(all_sum - 2 * Min)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


(n1, n2, n3) = map(int, input().split())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a3 = list(map(int, input().split()))
s1 = sum(a1)
s2 = sum(a2)
s3 = sum(a3)
m1 = min(a1)
m2 = min(a2)
m3 = min(a3)
val = min(m1 + m2, m2 + m3, m3 + m1, min(s1, s2, s3))
print(s1 + s2 + s3 - 2 * val)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	(a, b, c) = map(int, input().split())
	va = sorted(map(int, input().split()))
	vb = sorted(map(int, input().split()))
	vc = sorted(map(int, input().split()))
	sa = sum(va)
	sb = sum(vb)
	sc = sum(vc)
	s = sa + sb + sc
	a1 = 0
	a2 = 0
	b1 = 0
	b2 = 0
	c1 = 0
	c2 = 0
	if len(vb) > 1:
		a1 += abs(vb[0] - (sc - vc[0]) - sa) + abs(vc[0] - (sb - vb[0]))
		c1 += abs(vb[0] - (sa - va[0]) - sc) + abs(va[0] - (sb - vb[0]))
	else:
		a1 += s - 2 * vb[0]
		c1 += s - 2 * vb[0]
	if len(vc) > 1:
		a2 += abs(vc[0] - (sb - vb[0]) - sa) + abs(vb[0] - (sc - vc[0]))
		b1 += abs(vc[0] - (sa - va[0] - sb)) + abs(va[0] - (sc - vc[0]))
	else:
		a2 += s - 2 * vc[0]
		b1 += s - 2 * vc[0]
	if len(va) > 1:
		b2 += abs(va[0] - (sc - vc[0]) - sb) + abs(vc[0] - (sa - va[0]))
		c2 += abs(va[0] - (sb - vb[0]) - sc) + abs(vb[0] - (sa - va[0]))
	else:
		b2 += s - 2 * va[0]
		c2 += s - 2 * va[0]
	print(max(a1, a2, b1, b2, c1, c2))
main()


import sys
input = lambda : sys.stdin.readline().strip()

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def ii():
	return int(input())

def fi():
	return float(input())

def si():
	return input()
(n1, n2, n3) = mi()
(a1, a2, a3) = (li(), li(), li())
(s1, s2, s3) = (sum(a1), sum(a2), sum(a3))
(m1, m2, m3) = (min(a1), min(a2), min(a3))
m = m1 + m2 + m3 - max(m1, m2, m3)
ans = s1 + s2 + s3 - 2 * min(m, s1, s2, s3)
print(ans)


(n1, n2, n3) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
(x1, x2, x3) = (sum(a), sum(b), sum(c))
ans = x1 + x2 + x3 - 2 * min(min(x1, x2), x3)
(y1, y2, y3) = (min(a), min(b), min(c))
ans = max(ans, x1 + x2 + x3 - 2 * (y1 + y2 + y3 - max(y1, y2, y3)))
print(ans)


from collections import defaultdict, deque
import sys
import bisect
import math
input = sys.stdin.readline
mod = 1000000007
(a, b, c) = map(int, input().split())
a = [int(i) for i in input().split() if i != '\n']
b = [int(i) for i in input().split() if i != '\n']
c = [int(i) for i in input().split() if i != '\n']
a.sort()
b.sort()
c.sort()
f = min(sum(a[1:]), min(b[0], c[0])) + a[0]
s = min(sum(b[1:]), min(a[0], c[0])) + b[0]
t = min(sum(c[1:]), min(b[0], a[0])) + c[0]
suma = sum(a) + sum(b) + sum(c)
print(suma - 2 * min(f, s, t))