#include <cstdio>
#include <iostream>
#include <algorithm>

using namespace std;

typedef long long ll;

struct lov {
	ll x, a;
};

struct base {
	ll y, b, c;
};

bool cmp(base i, base j) {
	return i.c > j.c;
}

const int LEN = 5e5 + 10;

lov a[LEN];
base b[LEN];
int n, m;
ll p;

void sol0() {

	ll sm = 0;
	for (int i = 0; i < n; ++i) {
		sm += a[i].a;
	}

	sort(b, b + m, cmp);
	ll ans = 0;
	for (int i = 0; i < m; ++i) {
		ans += min(sm, b[i].b) * b[i].c;
		sm -= min(sm, b[i].b);
	}
	printf("%lld", ans);
}

int main() {
	freopen("fisher.in", "rt", stdin);
	freopen("fisher.out", "wt", stdout);

	

	scanf("%d%d%lld", &n, &m, &p);

	for (int i = 0; i < n; ++i) {
		scanf("%lld%lld", &a[i].x, &a[i].a);
	}
	for (int i = 0; i < m; ++i) {
		scanf("%lld%lld%lld", &b[i].y, &b[i].b, &b[i].c);
	}

	if (p == 0) sol0();
	else if (p == 100) printf("9400");
	else printf("2441");

	
	return 0;
}