import sys input = sys.stdin.readline class Accumulate2D: def __init__(self, A): self.H = len(A) self.W = len(A[0]) self.Ac = [[0] * (self.W + 1) for _ in range(self.H + 1)] for i in range(1, self.H + 1): for j in range(1, self.W + 1): self.Ac[i][j] = self.Ac[i - 1][j] + self.Ac[i][j - 1] - self.Ac[i - 1][j - 1] + A[i - 1][j - 1] def calc_sum(self, A, B, C, D): """ A <= x < C, B <= y < Dの範囲の和を求める。 """ return self.Ac[C][D] - self.Ac[C][B] - self.Ac[A][D] + self.Ac[A][B] H, W, N, M = map(int, input().split()) T, U, L, R, A = [0] * N, [0] * N, [0] * N, [0] * N, [0] * N for i in range(N): T[i], U[i], L[i], R[i], A[i] = map(int, input().split()) G = [[0] * 2005 for _ in range(2005)] for i in range(M): x, y, b, c = map(int, input().split()) xs = max(0, x - b) xg = min(H + 2, x + b) ys = max(0, y - b) yg = min(W + 2, y + b) G[xs][ys] += c G[xg + 1][ys] -= c G[xs][yg + 1] -= c G[xg + 1][yg + 1] += c S = Accumulate2D(G) L2 = S.Ac L2.pop(0) for i in range(len(L2)): L2[i].pop(0) S2 = Accumulate2D(L2) ans = 0 for t, u, l, r, a in zip(T, U, L, R, A): val = S2.calc_sum(t, l, u + 1, r + 1) if a - val > 0: ans += 1 print(ans)