import sys

input = sys.stdin.readline



from heapq import heappush, heappushpop



"""

銅貨の集合を固定すると、金-銀でソートして貪欲に金をとることになる

逆に金-銀でソートしておくと、金が埋まるまでは金or銅の2択



最後にとる金の番号X+nをfix → 手前は金-銅で貪欲 → queueで管理できる

"""



X,Y,Z = list(map(int,input().split()))

ABC = [[int(x) for x in input().split()] for _ in range(X+Y+Z)]



ABC.sort(key = lambda x: x[0]-x[1],reverse=True)



q = []

sum_a = 0

sum_c = 0

for a,b,c in ABC[:X]:

    # 金を入れる。銅-金の優先度

    heappush(q,(a-c,a))

    sum_a += a

A = [0] * (Z+1)

LC = [0] * (Z+1)

A[0] = sum_a

for i,(a,b,c) in enumerate(ABC[X:X+Z],1):

    sum_a += a

    x,del_a = heappushpop(q,(a-c,a))

    sum_a -= del_a

    sum_c += del_a-x

    A[i] = sum_a

    LC[i] = sum_c



ABC_rev = ABC[::-1]

q = []

sum_b = 0

sum_c = 0

for a,b,c in ABC_rev[:Y]:

    heappush(q,(b-c,b))

    sum_b += b

B = [0] * (Z+1)

RC = [0] * (Z+1)

B[0] += sum_b

for i,(a,b,c) in enumerate(ABC_rev[Y:Y+Z],1):

    sum_b += b

    x,del_b = heappushpop(q,(b-c,b))

    sum_b -= del_b

    sum_c += del_b-x

    B[i] = sum_b

    RC[i] = sum_c



answer = max(sum(x) for x in zip(A,LC,B[::-1],RC[::-1]))

print(answer)



import sys

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines



from heapq import heappop, heappush, heappushpop



X,Y,Z = list(map(int,readline().split()))

m = list(map(int,read().split()))

ABC = sorted(zip(m,m,m), key = lambda x: x[1] - x[0])



# 手前は A or C, 後半はB or Cでとるようにする



# A or Cで、AをX個とるルール

AC = [0] * (X+Y+Z)

q = [] # a -> cと変更する利点をマイナスで格納する

S = 0

for i,(a,b,c) in enumerate(ABC):

    S += a

    d = a - c

    if len(q) < X:

        heappush(q,d)

    else:

        S -= heappushpop(q,d)

    AC[i] = S



# B or Cで、BをY個とるルール

BC = [0] * (X+Y+Z)

q = [] # b -> cと変更する利点をマイナスで格納する

S = 0

for i,(a,b,c) in enumerate(ABC[::-1]):

    S += b

    d = b - c

    if len(q) < Y:

        heappush(q,d)

    else:

        S -= heappushpop(q,d)

    BC[i] = S

BC = BC[::-1]



answer = max(x+y for x,y in zip(AC[X-1:X+Z],BC[X:]))

print(answer)
import sys

input = sys.stdin.readline
from heapq import heappush, heappushpop

"""
銅貨の集合を固定すると、金-銀でソートして貪欲に金をとることになる
逆に金-銀でソートしておくと、金が埋まるまでは金or銅の2択
最後にとる金の番号X+nをfix → 手前は金-銅で貪欲 → queueで管理できる
"""
X, Y, Z = list(map(int, input().split()))
ABC = [[int(x) for x in input().split()] for _ in range(X + Y + Z)]
ABC.sort(key=lambda x: x[0] - x[1], reverse=True)
q = []
sum_a = 0
sum_c = 0
for a, b, c in ABC[:X]:
    # 金を入れる。銅-金の優先度
    heappush(q, (a - c, a))
    sum_a += a
A = [0] * (Z + 1)
LC = [0] * (Z + 1)
A[0] = sum_a
for i, (a, b, c) in enumerate(ABC[X : X + Z], 1):
    sum_a += a
    x, del_a = heappushpop(q, (a - c, a))
    sum_a -= del_a
    sum_c += del_a - x
    A[i] = sum_a
    LC[i] = sum_c
ABC_rev = ABC[::-1]
q = []
sum_b = 0
sum_c = 0
for a, b, c in ABC_rev[:Y]:
    heappush(q, (b - c, b))
    sum_b += b
B = [0] * (Z + 1)
RC = [0] * (Z + 1)
B[0] += sum_b
for i, (a, b, c) in enumerate(ABC_rev[Y : Y + Z], 1):
    sum_b += b
    x, del_b = heappushpop(q, (b - c, b))
    sum_b -= del_b
    sum_c += del_b - x
    B[i] = sum_b
    RC[i] = sum_c
answer = max(sum(x) for x in zip(A, LC, B[::-1], RC[::-1]))
print(answer)

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from heapq import heappop, heappush, heappushpop

X, Y, Z = list(map(int, readline().split()))
m = list(map(int, read().split()))
ABC = sorted(zip(m, m, m), key=lambda x: x[1] - x[0])
# 手前は A or C, 後半はB or Cでとるようにする
# A or Cで、AをX個とるルール
AC = [0] * (X + Y + Z)
q = []  # a -> cと変更する利点をマイナスで格納する
S = 0
for i, (a, b, c) in enumerate(ABC):
    S += a
    d = a - c
    if len(q) < X:
        heappush(q, d)
    else:
        S -= heappushpop(q, d)
    AC[i] = S
# B or Cで、BをY個とるルール
BC = [0] * (X + Y + Z)
q = []  # b -> cと変更する利点をマイナスで格納する
S = 0
for i, (a, b, c) in enumerate(ABC[::-1]):
    S += b
    d = b - c
    if len(q) < Y:
        heappush(q, d)
    else:
        S -= heappushpop(q, d)
    BC[i] = S
BC = BC[::-1]
answer = max(x + y for x, y in zip(AC[X - 1 : X + Z], BC[X:]))
print(answer)

-input = sys.stdin.readline -from heapq import heappush, heappushpop +read = sys.stdin.buffer.read +readline = sys.stdin.buffer.readline +readlines = sys.stdin.buffer.readlines +from heapq import heappop, heappush, heappushpop -""" -銅貨の集合を固定すると、金-銀でソートして貪欲に金をとることになる -逆に金-銀でソートしておくと、金が埋まるまでは金or銅の2択 -最後にとる金の番号X+nをfix → 手前は金-銅で貪欲 → queueで管理できる -""" -X, Y, Z = list(map(int, input().split())) -ABC = [[int(x) for x in input().split()] for _ in range(X + Y + Z)] -ABC.sort(key=lambda x: x[0] - x[1], reverse=True) -q = [] -sum_a = 0 -sum_c = 0 -for a, b, c in ABC[:X]: -    # 金を入れる。銅-金の優先度 -    heappush(q, (a - c, a)) -    sum_a += a -A = [0] * (Z + 1) -LC = [0] * (Z + 1) -A[0] = sum_a -for i, (a, b, c) in enumerate(ABC[X : X + Z], 1): -    sum_a += a -    x, del_a = heappushpop(q, (a - c, a)) -    sum_a -= del_a -    sum_c += del_a - x -    A[i] = sum_a -    LC[i] = sum_c -ABC_rev = ABC[::-1] -q = [] -sum_b = 0 -sum_c = 0 -for a, b, c in ABC_rev[:Y]: -    heappush(q, (b - c, b)) -    sum_b += b -B = [0] * (Z + 1) -RC = [0] * (Z + 1) -B[0] += sum_b -for i, (a, b, c) in enumerate(ABC_rev[Y : Y + Z], 1): -    sum_b += b -    x, del_b = heappushpop(q, (b - c, b)) -    sum_b -= del_b -    sum_c += del_b - x -    B[i] = sum_b -    RC[i] = sum_c -answer = max(sum(x) for x in zip(A, LC, B[::-1], RC[::-1])) +X, Y, Z = list(map(int, readline().split())) +m = list(map(int, read().split())) +ABC = sorted(zip(m, m, m), key=lambda x: x[1] - x[0]) +# 手前は A or C, 後半はB or Cでとるようにする +# A or Cで、AをX個とるルール +AC = [0] * (X + Y + Z) +q = []  # a -> cと変更する利点をマイナスで格納する +S = 0 +for i, (a, b, c) in enumerate(ABC): +    S += a +    d = a - c +    if len(q) < X: +        heappush(q, d) +    else: +        S -= heappushpop(q, d) +    AC[i] = S +# B or Cで、BをY個とるルール +BC = [0] * (X + Y + Z) +q = []  # b -> cと変更する利点をマイナスで格納する +S = 0 +for i, (a, b, c) in enumerate(ABC[::-1]): +    S += b +    d = b - c +    if len(q) < Y: +        heappush(q, d) +    else: +        S -= heappushpop(q, d) +    BC[i] = S +BC = BC[::-1] +answer = max(x + y for x, y in zip(AC[X - 1 : X + Z], BC[X:]))