#include <bits/stdc++.h>
#define int long long
#define P(x) cout << x << endl
#define D(x) P(#x << ": " << x)
#define F(i,n) for (int i=0; i<(int)(n); i++)
#define DEC(i,n) for (int i=(int)(n); --i>=0;)
#define S(s) (int)((s).size())
#define ALL(v) v.begin(), v.end()
#define MI(a,v) a = min(a,(v))
#define MA(a,v) a = max(a,(v))
#define V vector
#define pb insert_back
#define mt make_tuple
using namespace std;

struct abc {int a,b,c;};
int tot=0;
abc na(abc e) {tot += e.a; return {0, e.b-e.a, e.c-e.a};}
abc nb(abc e) {tot += e.b; return {e.a-e.b, 0, e.c-e.b};}
abc nc(abc e) {tot += e.c; return {e.a-e.c, e.b-e.c, 0};}
struct cmpa {bool operator()(abc e, abc f) {return mt(e.a,e.b,e.c) > mt(f.a,f.b,f.c);}};
struct cmpb {bool operator()(abc e, abc f) {return mt(e.b,e.a,e.c) > mt(f.b,f.a,f.c);}};
struct cmpc {bool operator()(abc e, abc f) {return mt(e.c,e.a,e.b) > mt(f.c,f.a,f.b);}};

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int x,y,z; cin>>x>>y>>z;
    multiset<abc, cmpa> qba, qca;
    multiset<abc, cmpb> qab, qcb;
    multiset<abc, cmpc> qac, qbc;
    F(i,x+y+z) {
        abc e; cin>>e.a>>e.b>>e.c;
        if (i<x) {
            e = na(e);
            qab.insert(e), qac.insert(e);
        } else if (i<x+y) {
            e = nb(e);
            qba.insert(e), qbc.insert(e);
        } else {
            e = nc(e);
            qca.insert(e), qcb.insert(e);
        }
    }
    #define T(s) (*s.begin())
    #define E(s,e) s.erase(s.find(e))
    bool cont;
    do {
        cont = false;
        if (T(qab).b + T(qba).a > 0) {
            abc ab = T(qab), ba = T(qba);
            E(qab,ab), E(qac,ab);
            E(qba,ba), E(qbc,ba);
            ab = nb(ab), ba = na(ba);
            qab.insert(ba);
            qac.insert(ba);
            qba.insert(ab);
            qbc.insert(ab);
            cont = true;
        }
        if (T(qac).c + T(qca).a > 0) {
            abc ac = T(qac), ca = T(qca);
            E(qac,ac), E(qab,ac);
            E(qca,ca), E(qcb,ca);
            ac = nc(ac), ca = na(ca);
            qac.insert(ca);
            qab.insert(ca);
            qca.insert(ac);
            qcb.insert(ac);
            cont = true;
        }
        if (T(qcb).b + T(qbc).c > 0) {
            abc cb = T(qcb), bc = T(qbc);
            E(qcb,cb), E(qca,cb);
            E(qbc,bc), E(qba,bc);
            cb = nb(cb), bc = nc(bc);
            qcb.insert(bc);
            qca.insert(bc);
            qbc.insert(cb);
            qba.insert(cb);
            cont = true;
        }
        if (T(qab).b + T(qbc).c + T(qca).a > 0) {
            abc ab = T(qab), bc = T(qbc), ca = T(qca);
            E(qab,ab), E(qac,ab);
            E(qbc,bc), E(qba,bc);
            E(qca,ca), E(qcb,ca);
            ab = nb(ab), bc = nc(bc), ca = na(ca);
            qab.insert(ca), qac.insert(ca);
            qba.insert(ab), qbc.insert(ab);
            qca.insert(bc), qcb.insert(bc);
            cont = true;
        }
        if (T(qac).c + T(qcb).b + T(qba).a > 0) {
            abc ac = T(qac), cb = T(qcb), ba = T(qba);
            E(qab,ac), E(qac,ac);
            E(qba,ba), E(qbc,ba);
            E(qcb,cb), E(qca,cb);
            ac = nc(ac), cb = nb(cb), ba = na(ba);
            qab.insert(ba), qac.insert(ba);
            qba.insert(cb), qbc.insert(cb);
            qca.insert(ac), qcb.insert(ac);
            cont = true;
        }
    } while (cont);
    P(tot);
}

Measured memory_bytes: 12800