#include <bits/stdc++.h>

#define fi first
#define se second
#define mp make_pair
#define pb push_back

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ll INF = 1e9 + 7;
const int N = 3e6 + 7;
const int M = 1e3 + 7;

struct str{
    int y, i;
    ll b, c, sum;
};

ll p[N], x[N], a[N];
str b[N], t[N];

int redo(int v){
    sort(p, p + v);
    int v1 = 0;
    for (int i = 0; i < v; i++)
        if (i == 0 || p[i] != p[i - 1])
            p[v1++] = p[i];
    return v1;
}

int init(int n, int m){
    int v = 0;
    for (int i = 0; i < n; i++){
        int xx, aa;
        scanf("%d%d", &xx, &aa);
        x[i] = xx, a[i] = aa;
        p[v++] = x[i];
    }
    for (int i = 0; i < m; i++){
        int by, bb, bc;
        scanf("%d%d%d", &by, &bb, &bc);
        b[i].y = by, b[i].c = bc, b[i].b = bb;
        p[v++] = b[i].y;
    }
    return redo(v);
}

bool cmp1(str a, str b){
    return a.c > b.c;
}

bool cmp2(str a, str b){
    return a.y < b.y;
}

void do_smth(int n){
    sort(b, b + n, cmp1);
    for (int i = 0; i < n; i++)
        b[i].i = i;
    sort(b, b + n, cmp2);
}

void add(int i, int l, int r, str x){
    if (x.i < l || x.i >= r)
        return;
    if (l == r - 1){
        t[i].b = x.b;
        t[i].sum = x.b * x.c;
        t[i].c = x.c;
        return;
    }
    int m = (l + r) / 2;
    add(i * 2 + 1, l, m, x);
    add(i * 2 + 2, m, r, x);
    t[i].b = t[i * 2 + 1].b + t[i * 2 + 2].b;
    t[i].sum = t[i * 2 + 1].sum + t[i * 2 + 2].sum;
}

ll get(int i, int l, int r, ll sum){
    if (t[i].b <= sum)
        return t[i].sum;
    if (l == r - 1)
        return sum * t[i].c;
    int m = (l + r) / 2;
    if (sum <= t[i * 2 + 1].b)
        return get(i * 2 + 1, l, m, sum);
    return t[i * 2 + 1].sum + get(i * 2 + 2, m, r, sum - t[i * 2 + 1].b);
}


int main()
{
    freopen("fisher.in", "r", stdin);
    freopen("fisher.out", "w", stdout);
    ios_base::sync_with_stdio(0);
    int n, m, pb = 0, pa = 0;
    ll cost, ans = 0, sum = 0;
    scanf("%d%d%I64d", &n, &m, &cost);
    int v = init(n, m);
    do_smth(m);
    for (int i = 0; i < v; i++){
        while (pb < m && b[pb].y <= p[i])
            add(0, 0, m, b[pb++]);
        while (pa < n && x[pa] <= p[i])
            sum += a[pa++];
        ans = max(ans, get(0, 0, m, sum) - cost * p[i]);
    }
    printf("%I64d", ans);
    return 0;
}
