import java.io.*;
import java.util.*;

public class SolveC {
	String fileName = "fisher";
	class Shop implements Comparable<Shop>{
		int size;
		int price;
		int id;
		int x;
		public Shop(int size, int price, int id, int x) {
			super();
			this.size = size;
			this.price = price;
			this.id = id;
			this.x = x;
		}
		@Override
		public String toString() {
			return "Shop [size=" + size + ", price=" + price + "]";
		}
		@Override
		public int compareTo(Shop that) {
			if (this.price == that.price) {
				return this.id - that.id;
			}
			return that.price - this.price;
		}
		
	}
	public void solve() throws IOException {
		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 ans = 0;
			long fish = 0;
			for (int i = 0; i < n; i++) {
				fish += a[i];
			}
			Shop[] sh = new Shop[m];
			for (int i = 0; i < m; i++) {
				sh[i] = new Shop(b[i],c[i], i, y[i]);
			}
			Arrays.sort(sh);
			for (int i = 0; i < m; i++) {
				if (sh[i].size > fish) {
					ans += 1L * fish * sh[i].price;
					fish = 0;
				} else {
					ans += 1L * sh[i].price * sh[i].size;
					fish -= sh[i].size;
				}
			}
			out.println(ans);
			return;
		}
		if (x[0] > y[m - 1]) {
			Shop[] sh = new Shop[m];
			for (int i = 0; i < m; i++) {
				sh[i] = new Shop(b[i],c[i], i, y[i]);
			}
			Arrays.sort(sh);
			long[] d = new long[n];
			int curFish = 0;
			int curShop = 0;
			while (curFish < n) {
				if (curShop == m) {
					break;
				}
				while (curShop < m && a[curFish] >= sh[curShop].size) {
					d[curFish] += sh[curShop].size * sh[curShop].price;
					a[curFish] -= sh[curShop].size;
					curShop++;
				}
				if (curShop < m) {
					sh[curShop].size -= a[curFish];
					d[curFish] += a[curFish] * sh[curShop].price;
				}
				if (curFish > 0) {
					d[curFish] += d[curFish - 1];
				}
				curFish++;
			}
			long ans = 0;
			for (int i = 0; i < n; i++) {
				if (ans < d[i] - p * x[i]) {
					ans = d[i] - p * x[i];
				}
			}
			out.println(ans);
		}
	}

	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 SolveC().run();
	}

}