#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#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);
    }
    friend int operator<(baza l, baza r)
    {
        return l.c > r.c;
    }
}ar[MAXN];

ll x[MAXN], n, m, p, sum, a[MAXN], cr[MAXN * 2], nc;

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];
        cr[nc++] = x[i];
    }
    x[n] = 1e10;
    for (ll i = 0; i < m; i++)
    {
        cin >> ar[i].y >> ar[i].b >> ar[i].c;
        cr[nc++] = ar[i].y;
    }
    sort(cr, cr + nc);
    nc = unique(cr, cr + nc) - cr;
    ar[m] = baza(1e10, 0, 0);
    if (p == 0)
    {
        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;
    }
    int i = 0, j = 0, c = 0;
    ll bres = 0, sum = 0, fish = 0;
    set<baza> cur;
    for (int i = 0; i < nc; i++)
    {
        c = cr[i];
        sum = 0;
        for (int i = 0; i < n; i++)
            if (x[i] <= c)
                sum += a[i];
        vector<baza> w;
        for (int i = 0; i < m; i++)
            if (ar[i].y <= c)
                w.push_back(ar[i]);
        sort(w.begin(), w.end(), cmp);
        ll res = 0;
        ll cur = sum;
        for (int i = 0; i < w.size(); i++)
        {
            if (cur > 0)
            {
                res += w[i].c * (min(cur, w[i].b));
                cur -= w[i].b;
            }
            else
                break;
        }
        //cerr << c << ' ' << res << '\n';
        bres = max(res - c * p, bres);
    }
    cout << bres << '\n';
    cerr << bres << '\n';
    return 0;
}
