#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>

using namespace std;

struct node {
	long long v, c;
};

long long p, pi = 0, fish = 0, a[500500], pr = 0;
int md, n, m, x[500500], y;
node tre[4000000];

inline void update(long long c, long long b) {
	long long g = c + md;
	tre[g].v += b;
	tre[g].c = tre[g].v * c;
	g = g / 2;
	while (g != 0) {
		tre[g].v = tre[2 * g].v + tre[2 * g + 1].v;
		tre[g].c = tre[2 * g].c + tre[2 * g + 1].c;
		g = g / 2;
	}
	return;
}

inline long long getmx(int v, int l, int r, long long b) {
	if (tre[v].c <= b) {
		return tre[v].c;
	}
	long long ansi = 0;
	while (l != r) {
		if (b > tre[v * 2 + 1].v) {
			ansi = ansi + tre[v * 2 + 1].c;
			b = b - tre[v * 2 + 1].v;
			r = (r + l) / 2;
			v = v * 2;
		}
		else {
			l = (r + l) / 2 + 1;
			v = v * 2 + 1;
		}
	}
	long long c = l;
	ansi = ansi + b * c;
	return ansi;
}

int main() {
	freopen("fisher.in", "r", stdin);
	freopen("fisher.out", "w", stdout);
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> m >> p;
	for (md = 1; md < 1000002; md = md * 2) {}
	for (int i = 0; i < n; i++) {
		cin >> x[i] >> a[i];
	}
	long long b, c;
	int ch1 = 0;
	for (int i = 0; i < m; i++) {
		cin >> y >> b >> c;
		while (ch1 < n && x[ch1] < y) {
			pr = p * (long long)(x[ch1]);
			fish = fish + a[ch1];
			pi = max(pi, getmx(1, 0, md - 1, fish) - pr);
			pr = getmx(1, 0, md - 1, fish);
			ch1++;
		}
		update(c, b);
		pr = p * (long long)(y);
		pi = max(pi, getmx(1, 0, md - 1, fish) - pr);
		pr = getmx(1, 0, md - 1, fish);
	}
	while (ch1 < n) {
		pr = p * (long long)(x[ch1]);
		fish = fish + a[ch1];
		pi = max(pi, getmx(1, 0, md - 1, fish) - pr);
		pr = getmx(1, 0, md - 1, fish);
		ch1++;
	}
	cout << pi;
}