import sys input = sys.stdin.buffer.readline H, W, N, M = map(int, input().split()) slimes = tuple(tuple(map(int, input().split())) for _ in range(N)) bombs = tuple(tuple(map(int, input().split())) for _ in range(M)) table = [[0] * (W + 2) for _ in range(H + 2)] for x, y, b, c in bombs: x -= 1 y -= 1 u = max(x - b, 0) + 1 d = min(x + b + 1, H) + 1 l = max(y - b, 0) + 1 r = min(y + b + 1, W) + 1 table[u][l] += c table[u][r] -= c table[d][l] -= c table[d][r] += c # 各マスの爆風を計算するimos for h in range(H + 1): for w in range(W + 2): table[h + 1][w] += table[h][w] for h in range(H + 2): for w in range(W + 1): table[h][w + 1] += table[h][w] # スライム用のimos for h in range(H + 1): for w in range(W + 2): table[h + 1][w] += table[h][w] for h in range(H + 2): for w in range(W + 1): table[h][w + 1] += table[h][w] ans = 0 for t, u, l, r, a in slimes: t -= 1 l -= 1 if table[t][l] - table[t][r] - table[u][l] + table[u][r] < a: ans += 1 print(ans)