#include <bits/stdc++.h>
#define fr(i, n) for (int i = 0; i < n; i++)
#define frab(i, a, b) for (int i = a; i < b; i++)
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long ll;

const ll N = 1e5 + 1;

ll x[N], a[N];

struct tn {
    ll y, b, c;
} ar[N];

bool cmp(tn a, tn b) {
    return a.c > b.c;
}

int main() {
    freopen("fisher.in", "r", stdin);
    freopen("fisher.out", "w", stdout);
    ll n, m, p;
    cin >> n >> m >> p;
    fr(i, n)
        cin >> x[i] >> a[i];
    fr(i, m)
        cin >> ar[i].y >> ar[i].b >> ar[i].c;
    sort(ar, ar + m, cmp);
    ll sum = accumulate(a, a + n, 0ll);
    ll ans = 0;
    fr(i, m) {
        if (sum == 0)
            break;
        ll val = min(sum, ar[i].b);
        ans += val * ar[i].c;
        sum -= val;
    }
    cout << ans;
}
