#include <bits/stdc++.h>
#define forn(i, n) for (int i = 0; i < n; i++)
#define sz(a) (int)a.size()
#define mp(a, b) make_pair(a, b)
#define pb(a) push_back(a)
#define all(a) a.begin(), a.end()

using namespace std;
typedef long long ll;
const int MAXN = 500500;
const string NAME = "fisher"; 
ll x[MAXN];
ll y[MAXN];
ll a[MAXN];
ll b[MAXN];
ll c[MAXN];
int n, m;
ll p;
ll cur;
ll ans;
multiset <pair <ll, ll> > pl;

void push(ll b, ll c)
{
	pl.insert(mp(-c, b)); 	
}

void recalc(ll point)
{                          
	ll res = - point * p;

	ll ost = cur;
		
	for (set <pair <ll, ll> > :: iterator it = pl.begin(); it != pl.end(); it++)
	{
		if (ost == 0)
			break;

		ll sell = min(ost, it->second);
		ost -= sell;
		res += sell * (-it->first);		
	}                                 

	ans = max(ans, res);
}


int main()
{
#ifndef LOCAL                                        
	freopen((NAME + ".in").c_str(), "rt", stdin);
	freopen((NAME + ".out").c_str(), "wt", stdout);
#endif	
	ios_base::sync_with_stdio(false);

	cin >> n >> m >> p;

	forn(i, n)
		cin >> x[i] >> a[i];

	forn(i, n - 1)
		a[i + 1] += a[i];

	forn(i, m)
		cin >> y[i] >> b[i] >> c[i];

	int ptrx = 0;
	int ptry = 0;
                                   
        while (ptrx < n && ptry < m)
        {
        	if (x[ptrx] <= y[ptry])
        	{
			cur = a[ptrx];  
			recalc(x[ptrx]);
			ptrx++;
        	}
        	else
        	{
        		push(b[ptry], c[ptry]);
        		recalc(y[ptry]);
			ptry++;
        	}                
        }

        while (ptrx < n)
        {
		cur = a[ptrx];  
		recalc(x[ptrx]);
		ptrx++;
	}
	while (ptry < m)
	{
		push(b[ptry], c[ptry]);
       		recalc(y[ptry]);
		ptry++;
        }

        cout << ans;
        return 0;
}