#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

struct spot
{
    int pos, price;
    spot(int a, int b)
    {
        pos = a;
        price = b;
    }
};

struct base
{
    int pos, amount, price;
    base (int a, int b, int c)
    {
        pos = a;
        amount = b;
        price = c;
    }
};

bool byprice(base a, base b)
{
    return a.price >= b.price;
}

vector<spot> spots;
vector<base> bases;

int main()
{
    freopen("fisher.in", "r", stdin);
    freopen("fisher.out", "w", stdout);
    int n, m, p;
    cin >> n >> m >> p;
    int totalfish = 0;
    for (int i = 0; i < n; i++)
    {
        int a, b;
        cin >> a >> b;
        spots.push_back(spot(a, b));
        totalfish += b;
    }
    for (int i = 0; i < m; i++)
    {
        int a, b, c;
        cin >> a >> b >> c;
        bases.push_back(base(a, b, c));
    }
    sort(bases.begin(), bases.end(), byprice);
    int basenow = 0;
    long long totalcash = 0;
    while (basenow < m && totalfish > 0)
    {
        totalcash += min(totalfish * bases[basenow].price, bases[basenow].amount * bases[basenow].price);
        totalfish = max(0, totalfish - bases[basenow].amount);
        basenow++;
    }
    cout << totalcash << endl;
    return 0;
}
