#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define SZ(x) ((int)((x).size()))

template <typename T1, typename T2>
string print_iterable(T1 begin_iter, T2 end_iter, int counter) {
    bool done_something = false;
    stringstream res;
    res << "[";
    for (; begin_iter != end_iter and counter; ++begin_iter) {
        done_something = true;
        counter--;
        res << *begin_iter << ", ";
    }
    string str = res.str();
    if (done_something) {
        str.pop_back();
        str.pop_back();
    }
    str += "]";
    return str;
}

vector<int> SortIndex(int size, std::function<bool(int, int)> compare) {
    vector<int> ord(size);
    for (int i = 0; i < size; i++) ord[i] = i;
    sort(ord.begin(), ord.end(), compare);
    return ord;
}

template <typename T>
bool MinPlace(T& a, const T& b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
bool MaxPlace(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template <typename S, typename T>
ostream& operator <<(ostream& out, const pair<S, T>& p) {
    out << "{" << p.first << ", " << p.second << "}";
    return out;
}

template <typename T>
ostream& operator <<(ostream& out, const vector<T>& v) {
    out << "[";
    for (int i = 0; i < (int)v.size(); i++) {
        out << v[i];
        if (i != (int)v.size()-1) out << ", ";
    }
    out << "]";
    return out;
}

template<class TH>
void _dbg(const char* name, TH val){
    clog << name << ": " << val << endl;
}
template<class TH, class... TA>
void _dbg(const char* names, TH curr_val, TA... vals) {
    while(*names != ',') clog << *names++;
    clog << ": " << curr_val << ", ";
    _dbg(names+1, vals...);
}

#if DEBUG && !ONLINE_JUDGE
    ifstream input_from_file("input.txt");
    #define cin input_from_file

    #define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
    #define dbg_arr(x, len) clog << #x << ": " << print_iterable(x, x+len, -1) << endl;
#else
    #define dbg(...)
    #define dbg_arr(x, len)
#endif

///////////////////////////////////////////////////////////////////////////
//////////////////// DO NOT TOUCH BEFORE THIS LINE ////////////////////////
///////////////////////////////////////////////////////////////////////////


typedef pair<LL, int> pli;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); // Remove in problems with online queries!

    int X, Y, Z;
    cin >> X >> Y >> Z;
    int N = X+Y+Z;
    vector<LL> A(N), B(N), C(N);
    for (int i = 0; i < N; i++) cin >> A[i] >> B[i] >> C[i];
    LL sumc = 0;
    for (int i = 0; i < N; i++) {
        sumc += C[i];
        A[i] = C[i] - A[i] + 1e9;
        B[i] = C[i] - B[i] + 1e9;
    }

    vector<int> fatto(N, 0);
    priority_queue<pli, vector<pli>, greater<pli>> pqx, pqy;
    for (int i = 0; i < N; i++) pqx.push({A[i], i}), pqy.push({B[i], i});
    priority_queue<pli, vector<pli>, greater<pli>> backx, backy;

    int x = X, y = Y;
    LL flowcost = 0;

    
    auto addx = [&](int idx) {
        x--;
        fatto[idx] = 1;
        flowcost += A[idx];
        backx.push({B[idx]-A[idx], idx});
    };

    auto addy = [&](int idy) {
        y--;
        fatto[idy] = -1;
        flowcost += B[idy];
        backy.push({A[idy]-B[idy], idy});
    };
    
    while (x+y > 0) {
        while (fatto[pqx.top().second]) pqx.pop();
        while (fatto[pqy.top().second]) pqy.pop();
        while (!backx.empty() and fatto[backx.top().second] != 1) backx.pop();
        while (!backy.empty() and fatto[backy.top().second] != -1) backy.pop();
        int idx = pqx.top().second;
        int idy = pqy.top().second;
        if (x > 0 and y > 0) {
            if (A[idx] < B[idy]) addx(idx);
            else addy(idy);
        }
        else if (x > 0) {
            if (backy.empty()) {
                addx(idx);
                continue;
            }
            int idby = backy.top().second;
            if (A[idx] < B[idy] + A[idby] - B[idby]) addx(idx);
            else {
                y++;
                fatto[idby] = 0;
                flowcost -= B[idby];
                addx(idby);
                addy(idy);
            }
        }
        else {
            if (backx.empty()) {
                addy(idy);
                continue;
            }
            int idbx = backx.top().second;
            if (B[idy] < A[idx] + B[idbx] - A[idbx]) addy(idy);
            else {
                x++;
                fatto[idbx] = 0;
                flowcost -= A[idbx];
                addy(idbx);
                addx(idx);
            }
        }
    }


    LL res = sumc - flowcost + (X+Y)*1e9;
    cout << res << "\n";
}


Measured memory_bytes: 9828