#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <map>
#include <vector>
#include <queue>
#include <set>
#include <cassert>
#include <ctime>
using namespace std;

typedef long long ll;

const int MAXN = (int)5e5 + 47;

int n, m, p;

struct Fish
{
	int x, a;
};

struct Shop
{
	int x, b, c;
};

vector < Fish > ff;
vector < Shop > ss;

void input()
{
	scanf("%d %d %d", &n, &m, &p);
	ff.resize(n);
	ss.resize(m);
	for (int i = 0; i < n; i++)
		scanf("%d %d", &ff[i].x, &ff[i].a);
	for (int i = 0; i < m; i++)
		scanf("%d %d %d", &ss[i].x, &ss[i].b, &ss[i].c);
}

bool cmp(const Shop &a, const Shop &b)
{
	return a.c > b.c || (a.c == b.c && a.b > b.b);
}

void out(ll ans)
{
	cout << ans;
	exit(0);
}

void task0()
{
	ll sum = 0;
	for (int i = 0; i < n; i++)
		sum += ff[i].a;
	sort(ss.begin(), ss.end(), cmp);
	ll ans = 0, kk, cnt = 0;
	for (int i = 0; i < (int)ss.size(); i++)
	{
		kk = min(sum, (ll)ss[i].b);
		sum -= kk;
		ans += kk * ss[i].c;
	}
	out(ans);
}

int main()
{
	freopen("fisher.in", "r", stdin);
	freopen("fisher.out", "w", stdout);
	input();
	// task0
	//if (p == 0)
	task0();
	return 0;
}