#include <queue>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <string.h>
#include <vector>
#include <map>
#include <assert.h>
#include <algorithm>
using namespace std;
#define debug printf("%s %d\n", __FUNCTION__, __LINE__)

const int maxn = 1e5 + 10;

typedef pair<int, int> Point;

int X, Y, Z;
int a[maxn][3];
int isset[maxn];
priority_queue<Point> in[3], out[3];

void push(int inx, int id) {
    //cout << inx << ' ' << id << endl;
    isset[inx] = id;
    out[id].push(Point(a[inx][(id + 1) % 3] - a[inx][id], inx));
    in[id].push(Point(-a[inx][id] + a[inx][(id + 2) % 3], inx));
}

void clear(auto &q, int id) {
    while (isset[q.top().second] != id) q.pop();
} 

void swapset(int x, int y) {
    swap(isset[x], isset[y]);
    push(x, isset[x]);
    push(y, isset[y]);
}

int main(int argc, char **argv) {
    scanf("%d%d%d", &X, &Y, &Z);
    for (int i = 1; i <= X + Y + Z; i++)
        for (int j = 0; j < 3; j++) scanf("%d", &a[i][j]);
    long long ans = 0;
    for (int i = 1; i <= X; i++) push(i, 0), ans += a[i][0];
    for (int i = X + 1; i <= X + Y; i++) push(i, 1), ans += a[i][1];
    for (int i = X + Y + 1; i <= X + Y + Z; i++) push(i, 2), ans += a[i][2];

    while (true) {
        bool flag = false;
        for (int i = 0; i < 3; i++) {
            int j = (i + 1) % 3;
            clear(out[i], i);
            clear(in[j], j);
            if (out[i].top().first + in[j].top().first > 0) {
                Point x = out[i].top(), y = in[j].top();
                ans += x.first + y.first;
                //cout << i << ' ' << j << endl;
                //cout << x.first << ' ' << y.first << endl;
                //cout << x.second << ' ' << y.second << endl;
                //cout << endl;
                swapset(x.second, y.second);
                flag = true;
            }
        }
        if (!flag) {
            if (out[0].top().first + out[1].top().first + out[2].top().first > 0) {
                Point x = out[0].top();
                Point y = out[1].top();
                Point z = out[2].top();
                ans += x.first + y.first + z.first;
                push(x.second, 1); push(y.second, 2); push(z.second, 0);
                flag = true;
            }
            //cout << in[0].top().first << ' ' << in[1].top().first << ' ' << in[2].top().first << endl;
            if (in[0].top().first + in[1].top().first + in[2].top().first > 0) {
                Point x = in[0].top();
                Point y = in[1].top();
                Point z = in[2].top();
                ans += x.first + y.first + z.first;
                push(x.second, 2); push(y.second, 0); push(z.second, 1);
                flag = true;
            }
        }
        if (!flag) break;
    }
    //while (!in[0].empty()) {
        //cout << in[0].top().first << endl;
        //in[0].pop();
    //}
    //cout << out[0].top().first << endl;
    //for (int i = 1; i <= X + Y + Z; i++) {
        //if (isset[i] == 1) {
            //cout << a[i][0] << ' ' << a[i][1] << ' ' << a[i][2] << endl;
        //}
    //}
    //for (int i = 1; i <= X + Y + Z; i++) printf("%d ", isset[i]);
    //puts("");
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4596