// A.cpp : Defines the entry point for the console application.
//

#include <fstream>
#include <vector>
#include <set>
#include <algorithm>

using namespace std;

vector < vector<pair<int, int>>> a;
vector <pair<int, int>> w;
vector<vector<int>> r, b;

void dfs(int x, int y)
{
	int i, j, dx, dy;
	b[x][y] = 1;
	if (b[x + a[x][y].first][y + a[x][y].second] == 0)
	{
		dfs(x + a[x][y].first, y + a[x][y].second);
	}
	else if (b[x + a[x][y].first][y + a[x][y].second] == 1)
	{
		b[x][y] = 3;
		i = x + a[x][y].first;
		j = y + a[x][y].second;
		while (i != x || j != y)
		{
			b[i][j] = 3;
			dx = a[i][j].first;
			dy = a[i][j].second;
			i += dx;
			j += dy;
		}
	}
	if (b[x][y] != 3)
		b[x][y] = 2;
}

int main()
{
	int n, m, p, i, j, k, t;
	long long sum = 0, ans = 0;
	vector<pair<long long, long long>> a;
	ifstream cin("fisher.in");
	ofstream cout("fisher.out");
	cin >> n >> m >> p;
	for (i = 0; i < n; i++)
	{
		cin >> j >> k;
		sum += (long long)(k);
	}

	for (i = 0; i < m; i++)
	{
		cin >> j >> k >> t;
		a.push_back(make_pair(t, k));
	}

	sort(a.rbegin(), a.rend());

	for (i = 0; i < a.size() && sum > 0; i++)
	{
		if (sum >= a[i].second)
		{
			ans += a[i].second * a[i].first;
			sum -= a[i].second;
		}
		else
		{
			ans += sum * a[i].first;
			sum = 0;
		}
	}

	cout << ans << endl;
	cout.close();
}

