#include <bits/stdc++.h>
#ifdef BUG
    #include "debug.hpp"
#else
    #define DEBUG(var)
#endif

using namespace std;
template< class T1, class T2 > inline istream &
operator>>( istream & fin, pair< T1, T2 > & pr )
{ fin >> pr.first >> pr.second; return fin; }
template< class T0, class T1, class T2 > inline istream &
operator>>( istream & fin, tuple< T0, T1, T2 > & t )
{ fin >> get<0>(t) >> get<1>(t) >> get<2>(t); return fin; }
template< class T > inline istream &
operator>>( istream & fin, vector< T > & a ) {
for(auto & u: a) fin >> u; return fin; }
template<class T, size_t n> inline istream &
operator>>( istream & fin, array<T, n> & a ) {
for(auto & u: a) fin >> u; return fin; }
template<class FwdIter> inline auto
dump(FwdIter first, FwdIter last, const char * dlm = " ") -> void {
typedef typename iterator_traits<FwdIter>::value_type value_type;
copy(first, last, ostream_iterator<value_type>(cout, dlm)); }
template<typename T> vector<T> & operator--(vector<T> & a)
{ for(auto & i: a) --i; return a; }
/* @@@ ----------------------------------- */

// agc018.contest.atcoder.jp/tasks/agc018_c

const int64_t inf = numeric_limits<int64_t>::max() >> 2;

// template<size_t s, size_t t>
// struct Comp
// {
//   const vector<array<int64_t, 3>> & a;
//   const vector<size_t> & idx;
//
//   Comp(const vector<array<int64_t, 3>> & a_, const vector<size_t> & idx_):
//     a(a_), idx(idx_) {};
//
//   inline bool
//   operator()(const size_t i, const size_t j) const
//   {
//     const auto a = idx[i] == s ? a[i][t] - a[i][s] : - inf;
//     const auto b = idx[j] == s ? a[j][t] - a[j][s] : - inf;
//     return a < b;
//   }
// }



int64_t agc018_c()
{
  array<size_t, 3> x;
  cin >> x;
  const size_t n = x[0] + x[1] + x[2];
  vector<array<int64_t, 3>> a(n);
  cin >> a;

  int64_t out = 0;
  vector<size_t> idx(n);
  for(size_t i = 0; i < x[0]; ++i)
  {
    idx[i] = 0;
    out += a[i][0];
  }

  for(size_t i = x[0]; i < x[0] + x[1]; ++ i)
  {
    idx[i] = 1;
    out += a[i][1];
  }

  for(size_t i = x[0] + x[1]; i < n; ++i)
  {
    idx[i] = 2;
    out += a[i][2];
  }

  typedef pair<int64_t, size_t> value_t;
  priority_queue<value_t, vector<value_t>> heap[3][3];

  for(size_t s = 0; s < 3; ++s)
    for(size_t t = 0; t < 3; ++t)
      if(s != t)
        for(size_t i = 0; i < n; ++i)
          if(idx[i] == s) heap[s][t].push({a[i][t] - a[i][s], i});

  const auto update = [&heap, &idx, &a](const size_t i) {
    for(size_t s = 0; s < 3; ++s)
      for(size_t t = 0; t < 3; ++t)
        if(s != t && idx[i] == s)
          heap[s][t].push({a[i][t] - a[i][s], i});
  };

  bool loop = true;
  while(loop)
  {
    loop = false;
    for(size_t s = 0; s < 3; ++s)
      for(size_t t = 0; t < 3; ++ t)
        if(s != t)
        {
          while(idx[heap[s][t].top().second] != s) heap[s][t].pop();
          while(idx[heap[t][s].top().second] != t) heap[t][s].pop();
          const auto i = heap[s][t].top().second;
          const auto j = heap[t][s].top().second;

          const auto inc = a[i][t] - a[i][s] + a[j][s] - a[j][t];
          if(0 < inc)
          {
            loop = true;
            heap[s][t].pop();
            heap[t][s].pop();
            out += inc;
            idx[i] = t;
            idx[j] = s;
            update(i);
            update(j);
          }
        }

    // 0 -> 1 -> 2 -> 0
    {
      while(idx[heap[0][1].top().second] != 0) heap[0][1].pop();
      while(idx[heap[1][2].top().second] != 1) heap[1][2].pop();
      while(idx[heap[2][0].top().second] != 2) heap[2][0].pop();

      const auto i = heap[0][1].top().second;
      const auto j = heap[1][2].top().second;
      const auto k = heap[2][0].top().second;
      const auto inc = a[i][1] - a[i][0] + a[j][2] - a[j][1] + a[k][0] - a[k][2];
      if(0 < inc)
      {
        loop = true;
        heap[0][1].pop();
        heap[1][2].pop();
        heap[2][0].pop();
        out += inc;
        idx[i] = 1;
        idx[j] = 2;
        idx[k] = 0;
        update(i);
        update(j);
        update(k);
      }
    }

    // 0 -> 2 -> 1 -> 0
    {
      while(idx[heap[0][2].top().second] != 0) heap[0][2].pop();
      while(idx[heap[2][1].top().second] != 2) heap[2][1].pop();
      while(idx[heap[1][0].top().second] != 1) heap[1][0].pop();

      const auto i = heap[0][2].top().second;
      const auto j = heap[2][1].top().second;
      const auto k = heap[1][0].top().second;
      const auto inc = a[i][2] - a[i][0] + a[j][1] - a[j][2] + a[k][0] - a[k][1];
      if(0 < inc)
      {
        loop = true;
        heap[0][2].pop();
        heap[2][1].pop();
        heap[1][0].pop();
        out += inc;
        idx[i] = 2;
        idx[j] = 1;
        idx[k] = 0;
        update(i);
        update(j);
        update(k);
      }
    }


  }


  return out;
}

int main(const int argc, char * argv [])
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  cout << agc018_c();

  return EXIT_SUCCESS;
}


Measured memory_bytes: 9332