#include <bits/stdc++.h>
using namespace std;

using ll = long long;

using tll = tuple<ll, ll, ll>;


template <unsigned int aa, unsigned int bb>
bool can_interchange(tll a, tll b){
    return -get<aa>(a) + get<bb>(a) + get<aa>(b) - get<bb>(b) > 0; }

template <unsigned int aa, unsigned int bb>
bool do_all_swaps(vector<tll>& a, vector<tll>& b){
    sort(begin(a), end(a), [](const tll& a, const tll& b){
        return -get<aa>(a) + get<bb>(a) < -get<aa>(b) + get<bb>(b); });
    sort(begin(b), end(b), [](const tll& a, const tll& b){
        return get<aa>(a) - get<bb>(a) < get<aa>(b) - get<bb>(b); });

    vector<tll> for_a, for_b;

    while(!a.empty() && !b.empty() && can_interchange<aa, bb>(a.back(), b.back())){
        for_a.push_back(b.back());
        for_b.push_back(a.back());
        a.pop_back();
        b.pop_back(); }
    a.insert(end(a), begin(for_a), end(for_a));
    b.insert(end(b), begin(for_b), end(for_b));
    return !for_a.empty(); }

template <unsigned int aa, unsigned int bb, unsigned int cc>
bool do_triple_swap(vector<tll>& a, vector<tll>& b, vector<tll>& c){
    sort(begin(a), end(a), [](const tll& a, const tll& b){
        return -get<aa>(a) + get<bb>(a) < -get<aa>(b) + get<bb>(b); });
    sort(begin(b), end(b), [](const tll& b, const tll& c){
        return -get<bb>(b) + get<cc>(b) < -get<bb>(c) + get<cc>(c); });
    sort(begin(c), end(c), [](const tll& c, const tll& a){
        return -get<cc>(c) + get<aa>(c) < -get<cc>(a) + get<aa>(a); });
    
    vector<tll> for_a, for_b, for_c;
    while(!a.empty() && !b.empty() && !c.empty() &&
        -get<aa>(a.back()) - get<bb>(b.back()) - get<cc>(c.back()) +
        get<bb>(a.back()) + get<cc>(b.back()) + get<aa>(c.back()) > 0){
        for_a.push_back(c.back());
        for_b.push_back(a.back());
        for_c.push_back(b.back());
        a.pop_back();
        b.pop_back();
        c.pop_back(); }
    a.insert(end(a), begin(for_a), end(for_a));
    b.insert(end(b), begin(for_b), end(for_b));
    c.insert(end(c), begin(for_c), end(for_c));
    return !for_a.empty(); }

        

int main(){
    int x, y, z;
    cin >> x >> y >> z;
    ll rez = 0;

    vector<tll> X, Y, Z;

    for(ll i = 0, a, b, c; i < x; ++i){
        cin >> a >> b >> c;
        X.emplace_back(a, b, c); }

    for(ll i = 0, a, b, c; i < y; ++i){
        cin >> a >> b >> c;
        Y.emplace_back(a, b, c); }

    for(ll i = 0, a, b, c; i < z; ++i){
        cin >> a >> b >> c;
        Z.emplace_back(a, b, c); }


    int nr = 0;
    bool done_something = true;
    do{
        ++nr;
        done_something = false;
        done_something = (do_all_swaps<0, 1>(X, Y) || done_something);
        done_something = (do_all_swaps<0, 2>(X, Z) || done_something);
        done_something = (do_all_swaps<1, 2>(Y, Z) || done_something);
        done_something = (do_triple_swap<0, 1, 2>(X, Y, Z) || done_something);
        done_something = (do_triple_swap<2, 1, 0>(Z, Y, X) || done_something);
    } while(done_something);

    assert(nr < 10);

    for(auto& x : X) rez += get<0>(x);
    for(auto& x : Y) rez += get<1>(x);
    for(auto& x : Z) rez += get<2>(x);
    

    cout << (rez) << endl;
    return 0; }


Measured memory_bytes: 5680