#include <iostream>
#include <cstdlib>
#include <queue>
#include <functional>
#include <algorithm>

using namespace std;

typedef long long int ll;

const int SIZE = 2000;

int a[SIZE];
int x[SIZE], y[SIZE];
pair<ll, ll> b[SIZE];

int main()
{
#ifndef _CONSOLE
	freopen("fisher.in", "r", stdin);
	freopen("fisher.out", "w", stdout);
#else
	freopen("input.txt", "r", stdin);
#endif

	int n, m, p;

	cin >> n >> m >> p;

	for (int i = 0; i < n; i++)
		cin >> x[i] >> a[i];

	for (int i = 0; i < m; i++)
		cin >> y[i] >> b[i].second >> b[i].first;

	ll sum = 0;
	for (int i = 0; i < n; i++)
		sum += a[i];

	sort(b, b + m, greater<pair<ll, ll>>());

	int i = 0;
	ll cost = 0;
	while (i < m && sum > 0) {
		ll t = min(sum, b[i].second);

		sum -= t;
		cost += t * b[i].first;
		i++;
	}

	cout << cost << endl;
}