#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define int long long

#define non 0
#define silver_medal 1
#define bronze_medal 2

const int nmax = (int)1e5 + 10;

int goldnum, silvernum, bronzenum;

int lastmax = 0;

struct Person {
   int gold, silver, bronze;
   int id;
} person[nmax];


class bronzeComp {
   public : bronzeComp() {};
   bool operator() (Person A, Person B) {
     return A.bronze < B.bronze;       
   }  
};

class silverComp {
   public : silverComp() {};
   bool operator() (Person A, Person B) {
      return A.silver < B.silver;
   }
};

class diffComp {
   public : diffComp() {};
   bool operator() (Person A, Person B) {
      return (A.bronze - A.silver) < (B.bronze - B.silver);
   }
};

priority_queue<Person, vector<Person >, bronzeComp > nonGroupGetBronze;
priority_queue<Person, vector<Person >, silverComp > nonGroupGetSilver;
priority_queue<Person, vector<Person >, diffComp > silverGroup;

int group[nmax];

void addOneMorePersonWithBronze() {
    
   Person nonTopBronze;
   while(true) {
      nonTopBronze = nonGroupGetBronze.top();
      int id = nonTopBronze.id;
      if(group[id] == non) break;
      nonGroupGetBronze.pop();
   }
   Person nonTopSilver;
   while(true) {
      nonTopSilver = nonGroupGetSilver.top();
      int id = nonTopSilver.id;
      if(group[id] == non) break;
      nonGroupGetSilver.pop();
   }
   Person silverTopDiff = silverGroup.top();
   
   int maxBronze = nonTopBronze.bronze;
   int maxexchange = silverTopDiff.bronze - silverTopDiff.silver + nonTopSilver.silver;
   if(maxBronze > maxexchange) {
      lastmax += maxBronze;
      nonGroupGetBronze.pop();
      group[nonTopBronze.id] = bronze_medal;
   } else {
      silverGroup.pop();
      nonGroupGetSilver.pop();
      silverGroup.push(nonTopSilver);
      group[silverTopDiff.id] = bronze_medal;
      group[nonTopSilver.id] = silver_medal;
      lastmax += maxexchange;
   }

}
int total;                 

void print_state() {

cout << endl;
   for(int i = 0; i < total ; i++ ) {
      cout << i << " :: " << group[i] << " ";
      switch(group[i]) {
         case 0 : cout << "gold"; break;
         case 1 : cout << "silver"; break;
         case 2 : cout << "bronze"; break;
         default : break;
      } cout << endl ;
   }
   cout << endl; 
   
}



signed main () {
   ios_base::sync_with_stdio(false);
   cin.tie(0); cout.tie(0);
   //freopen("in", "r", stdin);
   
   cin >> goldnum >> silvernum >> bronzenum;
   total = goldnum + silvernum + bronzenum;
       
   for(int i = 0; i < total; i ++ ) {
      cin >> person[i].gold >> person[i].silver >> person[i].bronze;          
      lastmax += person[i].gold;
      person[i].silver -= person[i].gold;
      person[i].bronze -= person[i].gold;
      person[i].gold = 0;
      person[i].id = i;
      nonGroupGetSilver.push(person[i]); 
   }
   
   memset(group, non, sizeof group);
   
    
   int iter = silvernum;
   while(iter --) {
      Person tmp = nonGroupGetSilver.top();
                   nonGroupGetSilver.pop();
      silverGroup.push(tmp);
      lastmax += tmp.silver;
      group[tmp.id] = silver_medal;  
   }
   for(int i = 0; i < total; i ++ ) {
      if(group[i] == silver_medal) continue;
      nonGroupGetBronze.push(person[i]);
   }    

  // print_state();

   for(int k = 1; k <= bronzenum; k ++ ) {
      addOneMorePersonWithBronze();
  //    print_state();
   }

   cout << lastmax << endl;
        
                          
   return 0;
}

Measured memory_bytes: 17388