#include <iostream>
#include <cstdio>
#include <algorithm>
#define MAXN 60000
#define ll long long
using namespace std;

struct baza
{
    ll y, b, c;
    baza(ll _y, ll _b, ll _c)
    {
        y = _y;
        b = _b;
        c = _c;
    }
    baza()
    {
        *this = baza(0, 0, 0);
    }
}ar[MAXN];

ll x[MAXN], n, m, p, sum, a[MAXN];

bool cmp(baza l, baza r)
{
    return l.c > r.c;
}

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

    }
    cerr << res << '\n';
    cout << res << '\n';
    return 0;
}
