#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <cassert>
#include <string.h>
#include <unordered_set>
#include <unordered_map>

using namespace std;

typedef long long int64;
typedef unsigned long long uint64;
#define two(X) (1<<(X))
#define twoL(X) (((int64)(1))<<(X))
#define contain(S,X) (((S)&two(X))!=0)
#define containL(S,X) (((S)&twoL(X))!=0)
const double pi=acos(-1.0);
const double eps=1e-11;
template<class T> inline void ckmin(T &a,T b){if(b<a) a=b;}
template<class T> inline void ckmax(T &a,T b){if(b>a) a=b;}
template<class T> inline T sqr(T x){return x*x;}
typedef pair<int,int> ipair;
#define SIZE(A) ((int)A.size())
#define LENGTH(A) ((int)A.length())
#define MP(A,B) make_pair(A,B)
#define PB(X) push_back(X)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,a) for(int i=0;i<(a);++i)
#define ALL(A) A.begin(),A.end()

const int maxn=200000+16;

int n,m;
int c[maxn];
int e[3];
int costs[3][maxn];
priority_queue<ipair> m1[3];
priority_queue<ipair> m2[3][3];
vector<int> best_opt;

void update(int key,int val)
{
	c[key]=val;
	if (val<0) 
		REP(w,3) m1[w].push(MP(costs[w][key],key));
	else
		REP(w,3) if (w!=val) m2[w][val].push(MP(costs[w][key]-costs[val][key],key));
}
void update_opt(vector<int> opt)
{
	if (opt>best_opt) best_opt=opt;
}
int shrink1(int w)
{
	for (;!m1[w].empty() && c[m1[w].top().second]>=0;m1[w].pop());
	return m1[w].empty()?-1:m1[w].top().second;
}
int shrink2(int w1,int w2)
{
	for (;!m2[w1][w2].empty() && c[m2[w1][w2].top().second]!=w2;m2[w1][w2].pop());
	return m2[w1][w2].empty()?-1:m2[w1][w2].top().second;
}
void solve1(int w)
{
	int key=shrink1(w);
	if (key<0) return;
	update_opt({costs[w][key],key,w});
}
void solve2(int w1,int w2)
{
	int key1=shrink2(w1,w2);
	if (key1<0) return;
	int key2=shrink1(w2);
	if (key2<0) return;
	update_opt({costs[w1][key1]-costs[w2][key1]+costs[w2][key2],key1,w1,key2,w2});
}
void solve3(int w1,int w2,int w3)
{
	int key1=shrink2(w1,w2);
	if (key1<0) return;
	int key2=shrink2(w2,w3);
	if (key2<0) return;
	int key3=shrink1(w3);
	if (key3<0) return;
	update_opt({costs[w1][key1]-costs[w2][key1]+costs[w2][key2]-costs[w3][key2]+costs[w3][key3],key1,w1,key2,w2,key3,w3});
}
int main()
{
#ifdef _MSC_VER
	freopen("input.txt","r",stdin);
#endif
	std::ios::sync_with_stdio(false);
	cin>>e[0]>>e[1]>>e[2];
	n=e[0]+e[1]+e[2];
	REP(i,n) cin>>costs[0][i]>>costs[1][i]>>costs[2][i];
	REP(i,n) update(i,-1);
	REP(step,n)
	{
		best_opt.clear();
		best_opt.push_back(-2000000000);
		REP(w,3) if (e[w]>0) solve1(w);
		REP(w1,3) if (e[w1]>0) REP(w2,3) if (w1!=w2) solve2(w1,w2);
		REP(w1,3) if (e[w1]>0) REP(w2,3) REP(w3,3) if (w1!=w2 && w1!=w3 && w2!=w3) solve3(w1,w2,w3);
		--e[best_opt[2]];
		for (int i=1;i<SIZE(best_opt);i+=2) update(best_opt[i],best_opt[i+1]);
	}
	int64 ret=0;
	REP(i,n) ret+=costs[c[i]][i];
	cout<<ret<<endl;
	return 0;
}



Measured memory_bytes: 7904