import java.io.*;
import java.util.Arrays;
import java.util.Comparator;
import java.util.StringTokenizer;

/**
 * Created by roi on 05.04.2016.
 */
public class Task3 {

    void solve(IO io) {
        int n = io.nextInt();
        int m = io.nextInt();
        int p = io.nextInt();
        Fish[] fs = new Fish[n];
        long sumFish = 0;
        for (int i = 0; i < n; i++) {
            int x = io.nextInt();
            int cap = io.nextInt();
            sumFish += cap;
            fs[i] = new Fish(x, cap);
        }

        int maxShopX = 0;
        Shop[] ss = new Shop[m];
        for (int i = 0; i < m; i++) {
            int x = io.nextInt();
            maxShopX = Math.max(maxShopX, x);
            int cap = io.nextInt();
            int price = io.nextInt();
            ss[i] = new Shop(x, cap, price);
        }

        Arrays.sort(ss, new Comparator<Shop>() {
            @Override
            public int compare(Shop o1, Shop o2) {
                if (o1.price == o2.price) {
                    return Integer.compare(o1.x, o2.x);
                }
                return -Integer.compare(o1.price, o2.price);
            }
        });

        if (ss[m - 1].x < fs[0].x) {

            long ans = 0;

            long profit = -maxShopX * p;
            int curShop = 0;
            int curCap = ss[0].cap;
            for (int i = 0; i < n; i++) {
                int dist;
                if (i == 0) {
                    dist = fs[0].x - maxShopX;
                } else {
                    dist = fs[i].x - fs[i - 1].x;
                }
                profit -= (dist) * p;

                long got = fs[i].cap;
                while (got > 0 && curShop < m) {
                    long amount = Math.min(got, curCap);
                    curCap -= amount;
                    profit += amount * ss[curShop].price;
                    if (curCap == 0) {
                        curShop++;
                        if (curShop == m) break;
                        curCap = ss[curShop].cap;
                    }
                }

                if (profit > ans) {
                    ans = profit;
                }
            }
            io.println(ans);

        } else {
            long ans = 0;
            for (int i = 0; i < m; i++) {
                long amount = Math.min(ss[i].cap, sumFish);
                ans += amount * ss[i].price;
                sumFish -= amount;
            }
            io.println(ans);
        }
    }

    class Fish {
        int x;
        int cap;

        Fish(int x, int cap) {
            this.x = x;
            this.cap = cap;
        }
    }

    class Shop {
        int x;
        int cap;
        int price;

        Shop(int x, int cap, int price) {
            this.x = x;
            this.cap = cap;
            this.price = price;
        }
    }


    public static void main(String[] args) {
        Task3 solver = new Task3();
        IO io = new IO("fisher");
        solver.solve(io);
        io.out.close();
    }

    static class IO {
        BufferedReader in;
        StringTokenizer tok;
        PrintWriter out;

        IO(String file) {
            try {
                in = new BufferedReader(new FileReader(file + ".in"));
                out = new PrintWriter(file + ".out");
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        String nextToken() {
            if (tok == null || !tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(in.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                    return null;
                }
            }
            return tok.nextToken();
        }

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

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

        int[] readIntArray(int len) {
            int[] res = new int[len];
            for (int i = 0; i < len; i++) {
                res[i] = nextInt();
            }
            return res;
        }

        void println(long x) {
            out.println(x);
        }
    }

}
