/* C_Fisher */

#pragma comment(linker, "/STACK:268435456")

#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <string>
#include <string.h>
#include <stdio.h>

using namespace std;

#define FOR(i, s, f) for (int i = (s); i < (f); ++i)
#define ROF(i, f, s) for (int i = (f) - 1; i >= (s); --i)
#define forn(i, f) for (int i = 0; i < (f); ++i)
#define rofn(i, f) for (int i = (f) - 1; i >= 0; --i)
#define forit(it, x) for (auto it = (x).begin(); it != (x).end(); ++it)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())

typedef long long ll;
typedef long double ld;
typedef const int cint;
typedef const ll cll;
#define vi vector < int >

#define TASK "fisher"

cint N = 5e5 + 3;

ll x[N], a[N];

struct places
{
	ll y, mass, cost;

	places(ll $y, ll $mass, ll $cost) : y($y), mass($mass), cost($cost) {}

	places() {}

	bool operator < (places & a)
	{
		return cost < a.cost;
	}
};

places place[N];

int main()
{
	freopen(TASK".in", "r", stdin);
	freopen(TASK".out", "w", stdout);

	int n, m, p;
	cin >> n >> m >> p;

	ll catched = 0;
	ll sum = 0;

	forn(i, n)
	{
		cin >> x[i] >> a[i];
		catched += a[i];
	}
	forn(i, m)
	{
		cin >> place[i].y >> place[i].mass >> place[i].cost;
	}

	sort(place, place + m);
	reverse(place, place + m);

	ll ans = 0;
	forn(i, m)
	{
		if (catched > place[i].mass)
		{
			catched -= place[i].mass;
			ans += place[i].mass * place[i].cost;
		}
		else
		{
			ans += catched * place[i].cost;
			catched = 0;
		}
	}

	cout << ans << endl;

	fclose(stdin);
	fclose(stdout);
	return 0;
}
