#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <utility>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <time.h>
#include <algorithm>
#include <map>
#include <set>
#define forn(i, n) for (int i = 0; i < (n); i++)
#define fornn(i, q, n) for (int i = (q); i < (n); i++)
#define mp make_pair
#define times clock() * 1.0 / CLOCKS_PER_SEC
using namespace std;

typedef long long ll;

int solve();
int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
#else
	freopen("fisher.in", "r", stdin), freopen("fisher.out", "w", stdout);
#endif
	solve();
	return 0;
}

const int MAXN = 107;

struct pt {
	ll x,  val,  cost;
};

bool cmp(pt a, pt b) {
	if (a.cost > b.cost) return true;
	if (a.cost == b.cost) return a.val < b.val;
	return false;
}
int solve() {
	int n, m, p;
	cin >> n >> m >> p;
	vector<pair<ll, ll > > G(n);
	vector<pt> H(m);
	ll ans = 0;
	vector<pair<ll, ll> > T;
	forn(i, n) {
		cin >> G[i].first >> G[i].second;
	}
	forn(i, m) {
		cin >> H[i].x >> H[i].val >> H[i].cost;
	}
	sort(G.begin(), G.end());
	ll sm = 0;
	forn(i, n) {
		sm += G[i].second;
	}
	sort(H.begin(), H.end(), cmp);
	ll pay = G.back().first * p;
	ll last = 0;
	ll lastp = G.back().first;
	set<pair<ll, ll> > S;
	forn(i, m) {
		pay += (H[i].x - lastp) * p;
		lastp = H[i].x;
		S.insert(mp(H[i].cost, H[i].val));
		ll c = sm;
		ll tt = 0;
		for (auto it = S.rbegin(); it != S.rend(); it++) {
			if ((*it).second <= c) {
				tt += (*it).first * (*it).second;
				c -= (*it).second;
			}
			else {
				tt += ((*it).first) * c;
				break;
			}
		}
		ans = max(ans, tt - pay);
	}
	cout << ans;
	return 0;
}