#include <cstdio>
#include <vector>
#include <algorithm>
#include <array>
#include <set>
#include <map>
#include <queue>
#include <tuple>
#include <unordered_set>
#include <unordered_map>
#include <functional>
#include <cassert>
#define repeat(i, n) for (int i = 0; (i) < int(n); ++(i))
#define repeat_from(i, m, n) for (int i = (m); (i) < int(n); ++(i))
#define repeat_reverse(i, n) for (int i = (n)-1; (i) >= 0; --(i))
#define repeat_from_reverse(i, m, n) for (int i = (n)-1; (i) >= int(m); --(i))
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
#define unittest_name_helper(counter) unittest_ ## counter
#define unittest_name(counter) unittest_name_helper(counter)
#define unittest __attribute__((constructor)) void unittest_name(__COUNTER__) ()
using ll = long long;
using namespace std;
template <class T> inline void setmax(T & a, T const & b) { a = max(a, b); }
template <class T> inline void setmin(T & a, T const & b) { a = min(a, b); }
template <typename X, typename T> auto vectors(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto vectors(X x, Y y, Z z, Zs... zs) { auto cont = vectors(y, z, zs...); return vector<decltype(cont)>(x, cont); }
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;

int main() {
    int x, y, z; scanf("%d%d%d", &x, &y, &z);
    const int n = x + y + z;
    vector<array<int, 3> > a(n);
    repeat (i, n) {
        scanf("%d%d%d", &a[i][0], &a[i][1], &a[i][2]);
    }
    vector<char> select(n);
    repeat (i, y) select[x + i] = 1;
    repeat (i, z) select[x + y + i] = 2;
    priority_queue<pair<ll, int> > que[3][3];
    auto push = [&](int i) {
        int p = select[i];
        repeat (q, 3) if (q != p) {
            que[p][q].emplace(a[i][q] - a[i][p], i);
        }
    };
    auto top = [&](int p, int q) {
        while (true) {
            int i = que[p][q].top().second;
            if (select[i] != p) {
                que[p][q].pop();
            } else {
                return i;
            }
        }
    };
    ll result = 0;
    repeat (i, n) {
        result += a[i][select[i]];
        push(i);
    }
    for (bool modified = true; modified; ) {
        modified = false;
        repeat (p, 3) repeat (q, 3) if (q != p) {
            while (true) {
                int i = top(p, q);
                int j = top(q, p);
                ll delta =
                    + a[i][q] - a[i][p]
                    + a[j][p] - a[j][q];
                if (delta > 0) {
                    result += delta;
                    select[i] = q;
                    select[j] = p;
                    que[p][q].pop();
                    que[q][p].pop();
                    push(i);
                    push(j);
                    modified = true;
                } else {
                    break;
                }
            }
            repeat (r, 3) if (r != p and r != q) {
                while (true) {
                    int i = top(p, q);
                    int j = top(q, r);
                    int k = top(r, p);
                    ll delta =
                        + a[i][q] - a[i][p]
                        + a[j][r] - a[j][q]
                        + a[k][p] - a[k][r];
                    if (delta > 0) {
                        result += delta;
                        select[i] = q;
                        select[j] = r;
                        select[k] = p;
                        que[p][q].pop();
                        que[q][r].pop();
                        que[r][p].pop();
                        push(i);
                        push(j);
                        push(k);
                        modified = true;
                    } else {
                        break;
                    }
                }
            }
        }
    }
    printf("%lld\n", result);
    return 0;
}


Measured memory_bytes: 7964