#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
#include <iostream>
#include <cstdio>

using namespace std;

int main(){
    ifstream fin("fisher.in");
    ofstream fout("fisher.out");

    int n, m, p;

    fin >> n >> m >> p;

    vector< pair<long long, long long> > x(n);
    vector< vector<long long> > y(m, vector<long long>(3));

    for(int i = 0; i < n; ++i){
        fin >> x[i].first >> x[i].second;
    }

    for(int i = 0; i < m; ++i){
        fin >> y[i][2] >> y[i][1] >> y[i][0];
    }

    long long ans1 = 0, ans2 = 0, ans3 = 0;


        for(int i = 0; i < n; ++i){
            ans1 += x[i].second;
        }

        sort(y.rbegin(), y.rend());
        int i = 0;
        while (ans1 > 0 && i < m){
            ans3 += min(y[i][1], ans1) * y[i][0];
            ans1 -= min(y[i][1], ans1);
            ++i;
        }


    fout << ans3 << endl;

    fout.close();
    fin.close();
    return 0;
}
