import sys input = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 7) H, W, N, M = map(int, input().split()) slime = tuple(tuple(map(int, input().split())) for _ in range(N)) bomb = tuple(tuple(map(int, input().split())) for _ in range(M)) G = [[0] * (W+2) for _ in range(H+2)] for x, y, b, c in bomb: Lx = max(0, x-b) Rx = min(H, x+b+1) Ly = max(0, y-b) Ry = min(W, y+b+1) G[Lx][Ly] += c G[Lx][Ry] -= c G[Rx][Ly] -= c G[Rx][Ry] += c for i in range(H+2): for j in range(W+2): if i: G[i][j] += G[i-1][j] for i in range(H+2): for j in range(W+2): if j: G[i][j] += G[i][j-1] for i in range(H+2): for j in range(W+2): if i: G[i][j] += G[i-1][j] for i in range(H+2): for j in range(W+2): if j: G[i][j] += G[i][j-1] ans = 0 for t, u, l, r, a in slime: t -= 1 l -= 1 damage = G[t][l] + G[u][r] - G[t][r] - G[u][l] ans += damage < a print(ans)