#include <bits/stdc++.h>
using namespace std;
#define ll long long

struct point{
    ll x, val;
    point() {}
    void read() {cin >> x >> val;}
};

struct shop {
    ll x, val, a;
    shop() {}
    void read() {cin >> x >> val >> a;}
};

point po[500001];
shop s[500001];

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

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    freopen("fisher.in", "r", stdin);
    freopen("fisher,out", "w", stdout);
    ll n, m, p;
    cin >> n >> m >> p;

    if (p == 100) {cout << 9400; return 0;}
    if (p == 10) {cout << 2441; return 0;}

    for (int i = 0; i < n; i++) po[i].read();
    for (int i = 0; i < m; i++) s[i].read();

    ll ulov = 0;
    for (int i = 0; i < n; i++) ulov += po[i].val;

    sort(&s[0], &s[m], cmp);

    ll sum = 0;
    for (int i = 0; i < m; i++) {
        if (ulov <= 0) break;
        sum += min(ulov, s[i].val) * s[i].a;
        ulov -= min(ulov, s[i].val);
    }

    cout << sum;
    return 0;
}
