

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class C {
	public static StringTokenizer st;
	public static BufferedReader in;
	public static PrintWriter out;
	public static String nextToken() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			st = new StringTokenizer(in.readLine());
		}
		return st.nextToken();
	}
	public static int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}
	public static class Station implements Comparable<Station> {
		public final int b, c;

		public Station(int b, int c) {
			this.b = b;
			this.c = c;
		}

		@Override
		public int compareTo(Station o) {
			return Integer.compare(c, o.c);
		}
		
	}
	public static final int[] DIR_X = {0, 1, 0, -1};
	public static final int[] DIR_Y = {1, 0, -1, 0};
	public static void main(String[] args) throws IOException {
		boolean test = false;
		String fileName = "fisher";
		if (test) {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
		} else {
			in = new BufferedReader(new FileReader(fileName + ".in"));
			out = new PrintWriter(fileName + ".out");
		}
		int n = nextInt();
		int m = nextInt();
		int p = nextInt();
		int[] x = new int[n];
		int[] a = new int[n];
		int[] y = new int[m];
		int[] b = new int[m];
		int[] c = new int[m];
		for (int i = 0; i < n; i++) {
			x[i] = nextInt();
			a[i] = nextInt();
		}
		for (int i = 0; i < m; i++) {
			y[i] = nextInt();
			b[i] = nextInt();
			c[i] = nextInt();
		}
		if (p == 0) {
			long fish = 0;
			for (int i = 0; i < n; i++) {
				fish += a[i];
			}
			Station[] s = new Station[m];
			for (int i = 0; i < m; i++) {
				s[i] = new Station(b[i], c[i]);
			}
			long ans = 0;
			Arrays.sort(s);
			for (int i = m - 1; i >= 0; i--) {
				if (fish == 0) {
					break;
				}
				int sold = (int) Math.min(fish, s[i].b);
				fish -= sold;
				ans += sold * s[i].c;
			}
			out.print(ans);
			in.close();
			out.close();
			return;
		}
		if (x[0] > y[m - 1]) {
			Station[] s = new Station[m];
			for (int i = 0; i < m; i++) {
				s[i] = new Station(b[i], c[i]);
			}
			Arrays.sort(s);
			int j = m - 1;
			int left = s[j].b;
			long max = 0;
			long q = 0;
			int prev = 0;
			down : for (int i = 0; i < n; i++) {
				q -= (x[i] - prev) * (long) p;
				prev = x[i];
				int fish = a[i];
				while (fish > 0) {
					int soldHere = Math.min(left, fish);
					q += s[j].c * (long) soldHere;
					left -= soldHere;
					fish -= soldHere;
					if (left == 0) {
						if (j == 0) {
							max = Math.max(max, q);
							break down;
						}
						left = s[--j].b;
					}
				}
				max = Math.max(max, q);
			}
			out.print(max);
			in.close();
			out.close();
			return;
		}
		in.close();
		out.close();
	}

}
/*
3 3
45
30 30
40 30
50 30
10 20 60
20 20 25
25 20 20

*/