import sys import numpy as np 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 = np.zeros((H + 2, W + 2), dtype=np.int64) 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 table = table.cumsum(axis=0) table = table.cumsum(axis=1) # スライム用のimos table = table.cumsum(axis=0) table = table.cumsum(axis=1) 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)