#include <bits/stdc++.h>

using namespace std;

#ifdef SG
	#include <debug.h>
#else
	#define show(...)
	#define debug(...)
	#define deepen(...)
	#define timer(...)
#endif

#define ARG4(_1,_2,_3,_4,...) _4

#define forn3(i,l,r) for (int i = int(l); i < int(r); ++i)
#define forn2(i,n) forn3 (i, 0, n)
#define forn(...) ARG4(__VA_ARGS__, forn3, forn2) (__VA_ARGS__)

#define ford3(i,l,r) for (int i = int(r) - 1; i >= int(l); --i)
#define ford2(i,n) ford3 (i, 0, n)
#define ford(...) ARG4(__VA_ARGS__, ford3, ford2) (__VA_ARGS__)

#define ve vector
#define pa pair
#define tu tuple
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define fs first
#define sc second
#define all(a) (a).begin(), (a).end()
#define sz(a) ((int)(a).size())

typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef unsigned char uc;
typedef pa<int, int> pii;
typedef pa<int, ll> pil;
typedef pa<ll, int> pli;
typedef pa<ll, ll> pll;
typedef ve<int> vi;

const ld pi = 3.1415926535897932384626433832795l;

template<typename T> inline auto sqr (T x) -> decltype(x * x) {return x * x;}
template<typename T1, typename T2> inline bool umx (T1& a, T2 b) {if (a < b) {a = b; return 1;} return 0;}
template<typename T1, typename T2> inline bool umn (T1& a, T2 b) {if (b < a) {a = b; return 1;} return 0;}

const int N = 100100;
ll a[3][N];
int p[3][N];
int kol[3];
int sz;
int t[4 * N];

int fnd(int i, int x, int y, int l, int r) {
	if (x > r || y < l)
		return 0;
	if (x >= l && y <= r)
		return t[i];
	return fnd(2 * i, x, (x + y) >> 1, l, r) + fnd(2 * i + 1, ((x + y) >> 1) + 1, y, l, r);
}

void upd(int v, int k) {
	v += sz;
	t[v] = k;
	v >>= 1;
	while (v > 0) {
		t[v] = t[2 * v] + t[2 * v + 1];
		v >>= 1;
	}
}

set<pii> Y, Z;
set<int> X, XY, XZ;
set<pii> YZ1, YZ2;
int fst[N], lst[N];
int obrp[N];
ll tek;

void addYZ(int idx) {
	YZ1.insert(mp(a[2][idx] - a[1][idx], idx));
	tek += a[1][idx];
	if (YZ1.size() > kol[1]) {
		pii k = *(--YZ1.end());
		YZ1.erase(k);
		idx = k.sc;
		tek -= a[1][idx];
		tek += a[2][idx];
		YZ2.insert(mp(a[2][idx] - a[1][idx], idx));
	}
}

void eraseYZ(int idx) {
	if (YZ1.find(mp(a[2][idx] - a[1][idx], idx)) != YZ1.end()) {
		tek -= a[1][idx];
		YZ1.erase(mp(a[2][idx] - a[1][idx], idx));
	}
	if (YZ2.find(mp(a[2][idx] - a[1][idx], idx)) != YZ2.end()) {
		tek -= a[2][idx];
		YZ2.erase(mp(a[2][idx] - a[1][idx], idx));
	}
	while (YZ1.size() < kol[1] && !YZ2.empty()) {
		YZ1.insert(*YZ2.begin());
		int idx = YZ2.begin()->sc;
		tek -= a[2][idx];
		tek += a[1][idx];
		YZ2.erase(YZ2.begin());
	}
}

int main () {
	cout.setf(ios::showpoint | ios::fixed);
	cout.precision(20);
#ifdef SG
	freopen((problemname + ".in").c_str(), "r", stdin);
//	freopen((problemname + ".out").c_str(), "w", stdout);
#endif
//	freopen("c.in", "r", stdin);
	int n;
	forn(i, 3)
		cin >> kol[i];
	n = kol[0] + kol[1] + kol[2];
	forn(i, n)
		cin >> a[0][i] >> a[1][i] >> a[2][i];
	forn(i, 3) {
		forn(j, n) {
			p[i][j] = j;
		}	
		vi p0 = {0, 0, 2}, p1 = {1, 2, 1};
		sort(p[i], p[i] + n, [&](int aa, int bb) {
			return a[p0[i]][aa] - a[p1[i]][aa] > a[p0[i]][bb] - a[p1[i]][bb];
		});
	}
	for (int i = 0; i < n;) {
		int j = i;
		for (; j < n && a[2][p[2][i]] - a[1][p[2][i]] == a[2][p[2][j]] - a[1][p[2][j]]; ++j);
		for (int k = i; k < j; ++k) {
			fst[p[2][k]] = i;
			lst[p[2][k]] = j - 1;
		}
		i = j;
	}
	forn(i, n)
		obrp[p[2][i]] = i;
	sz = 1;
	while (sz < n) sz <<= 1;
	forn(i, n) {
		upd(i, 1);
	}
	forn(i, n) {
		int idx = p[1][i];
		Y.insert(mp(a[2][idx] - a[1][idx], idx));
		XY.insert(idx);
		addYZ(idx);		
	}
	int ptr = n;
	ll ans = 0;
	forn(i, 3)
		debug(p[i], p[i] + n);
	forn(i, n) {
		int idx = p[0][i];
		XZ.insert(idx);
		if (XY.find(idx) == XY.end()) {
			Z.insert(mp(a[2][idx] - a[1][idx], idx));
		} else {
			X.insert(idx);
			tek += a[0][idx];
			Y.erase(mp(a[2][idx] - a[1][idx], idx));
			eraseYZ(idx);
			upd(obrp[idx], 0);
		}
		if ((int)X.size() < kol[0])
			continue;
		while (ptr > 0 && (int)X.size() >= kol[0]) {
			int idx2 = p[1][ptr - 1];
			if (XZ.find(idx2) != XZ.end()) {
				if ((int)X.size() == kol[0])
					break;
				X.erase(idx2);
				Z.insert(mp(a[2][idx2] - a[1][idx2], idx2));
				tek -= a[0][idx2];
				addYZ(idx2);
				upd(obrp[idx2], 1);
			} else {
				Y.erase(mp(a[2][idx2] - a[1][idx2], idx2));
			}
			XY.erase(idx2);
			ptr--;
		}
		debug(all(X));
		debug(all(Z));
		debug(all(Y));
		if (!Z.empty()) {
			int minz = Z.begin()->sc;
		
			if (fnd(1, 0, sz - 1, 0, fst[minz]) > kol[2]) {
				continue;
			}
		}
		if (!Y.empty()) {
			int maxy = (--Y.end())->sc;
			if (fnd(1, 0, sz - 1, lst[maxy], n - 1) > kol[1]) {
				continue;
			}
		}
		debug(i);
		debug(tek);
		umx(ans, tek);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 20480