//created by missever

#include<bits/stdc++.h>
#define MAX 1000000007
using namespace std;
typedef long long LL;
typedef pair<int,int> P;
typedef pair<int,P> PI;

const int maxn = 1e5 + 5;
priority_queue<P> q[3][3];
vector<int> f[3];
int a[3][maxn];
bool t[3][maxn];

int main() {
    int n,x[3],i,j,u,v,k;
    LL s = 0;
    scanf("%d%d%d",&x[0],&x[1],&x[2]);
    n = x[0] + x[1] + x[2];
    for(i = 0; i < n; i++) scanf("%d%d%d",&a[0][i],&a[1][i],&a[2][i]);
    v = 0;
    for(u = 0; u < 3; u++) {
        for(i = v; i < v + x[u]; i++) {
            s += a[u][i];
            t[u][i] = 1;
            for(j = 0; j < 3; j++) {
                if(j == u) continue;
                q[u][j].push(P(a[j][i] - a[u][i],i));
            }
        }
        v += x[u];
    }

    bool vis = 1;
    while(vis) {
        vis = 0;
        for(u = 0; u < 3; u++) {
            for(v = 0; v < 3; v++) {
                while(!q[u][v].empty() && !t[u][q[u][v].top().second]) q[u][v].pop();
            }
        }
        for(u = 0; u < 3; u++) {
            if(vis) break;
            for(v = 0; v < 3; v++) {
                if(u == v) continue;
                if(!q[u][v].empty() && !q[v][u].empty()) {
                    if(q[u][v].top().first + q[v][u].top().first > 0) {
                        P e1 = q[u][v].top();
                        P e2 = q[v][u].top();
                        s += e1.first + e2.first;
                        i = e1.second;
                        j = e2.second;
                        t[u][i] = 0;
                        t[v][j] = 0;
                        k = 3 - u - v;
                        q[v][k].push(P(a[k][i] - a[v][i],i));
                        q[v][u].push(P(a[u][i] - a[v][i],i));
                        q[u][k].push(P(a[k][j] - a[u][j],j));
                        q[u][v].push(P(a[v][j] - a[u][j],j));
                        t[v][i] = 1;
                        t[u][j] = 1;
                        vis = 1;
                        break;
                    }
                }
                k = 3 - u - v;
                if(!q[u][v].empty() && !q[v][k].empty() && !q[k][u].empty()) {
                    if(q[u][v].top().first + q[v][k].top().first + q[k][u].top().first > 0) {
                        P e1 = q[u][v].top();
                        P e2 = q[v][k].top();
                        P e3 = q[k][u].top();
                        s += e1.first + e2.first + e3.first;
                        i = e1.second;
                        j = e2.second;
                        int l = e3.second;
                        t[u][i] = 0;
                        t[v][j] = 0;
                        t[k][l] = 0;
                        q[v][k].push(P(a[k][i] - a[v][i],i));
                        q[v][u].push(P(a[u][i] - a[v][i],i));
                        q[k][u].push(P(a[u][j] - a[k][j],j));
                        q[k][v].push(P(a[v][j] - a[k][j],j));
                        q[u][k].push(P(a[k][l] - a[u][l],l));
                        q[u][v].push(P(a[v][l] - a[u][l],l));
                        t[v][i] = 1;
                        t[u][l] = 1;
                        t[k][j] = 1;
                        vis = 1;
                        break;
                    }
                }
            }
        }
    }
    printf("%lld\n",s);
    return 0;
}


Measured memory_bytes: 4980