#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <string>

using namespace std;

#define lint long long int

struct p1
{
	lint x, a;
};

struct p2
{
	lint x, b, c;
};

bool operator<(p2 a, p2 b)
{
	return a.c > b.c;
}

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

	lint n, m, p;
	cin >> n >> m >> p;

	vector<p1> v1;
	vector<p2> v2;

	lint fish = 0;

	for (int i = 0; i < n; i++)
	{
		p1 t;
		cin >> t.x >> t.a;
		v1.push_back(t);

		fish += t.a;
	}

	for (int i = 0; i < m; i++)
	{
		p2 t;
		cin >> t.x >> t.b >> t.c;
		v2.push_back(t);
	}

	sort(v2.begin(), v2.end());
	
	lint res = 0;

	int curD = v1[0].x;
	int cur1 = 0;

	res -= p * curD;

	fish = v1[0].a;

	for (int i = 0; i < v2.size(); i++)
	{
		while (v2[i].b > 0)
		{
			lint x = min(fish, v2[i].b);
			res += v2[i].c * x;
			fish -= x;
			v2[i].b -= x;

			cur1++;
			if (cur1 > v1.size())
				break;
			curD += v1[cur1].x - v1[cur1 - 1].x;
			fish += v1[cur1].a;
		}

	}

	cout << res;

}