/**
 * Created by roi on 05.04.2016.
 */
import java.io.*;
import java.util.*;

public class C {
    String fileName = "fisher";
    public class par implements Comparable{
        long b;
        long c;
        par(long b, long c){
            this.b = b;
            this.c = c;
        }
        @Override
        public int compareTo(Object o) {
            par en = (par)o;
            if (this.c < en.c){
                return -1;
            }
            if (this.c > en.c){
                return 1;
            }
            return 0;
        }
    }
    public void solve() throws IOException {
        // write your code here
        int n = nextInt();
        int m = nextInt();
        long p = nextLong();
        long[] a = new long[n];
        long[] b = new long[m];
        long[] x = new long[n];
        long[] y = new long[m];
        long[] c = new long[m];
        for (int i = 0; i < n; i++){
            x[i] = nextLong();
            a[i] = nextLong();
        }
        for (int i = 0; i < m; i++){
            y[i] = nextInt();
            b[i] = nextInt();
            c[i] = nextInt();
        }
        if ((true)){
            long fish = 0;
            long res = 0;
            for (int i = 0; i < n; i++){
                fish += a[i];
            }
            par[] u = new par[m];   // mass and price
            for (int i = 0; i < m; i++){
                u[i] = new par(b[i], c[i]);
            }
            Arrays.sort(u);
            for (int i = m - 1; i > -1; i--){
                if (fish > 0){
                    long k = Math.min(fish, u[i].b);
                    fish -= k;
                    res += k * u[i].c;
                }
            }
            res -= x[n] *p;
            out.print(res);
        }
        out.close();
    }

    public void run() {
        try {
            br = new BufferedReader(new FileReader(fileName + ".in"));
            out = new PrintWriter(fileName + ".out");

            solve();

            out.close();
        } catch (IOException e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    BufferedReader br;
    StringTokenizer in;
    PrintWriter out;

    public String nextToken() throws IOException {
        while (in == null || !in.hasMoreTokens()) {
            in = new StringTokenizer(br.readLine());
        }
        return in.nextToken();
    }

    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    public static void main(String[] args) throws IOException {
        Locale.setDefault(Locale.US);
        new C().run();
    }

}
