import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.buffer.readline()) def LI(): return list(map(int, sys.stdin.buffer.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def LI1(): return list(map(int1, sys.stdin.buffer.readline().split())) def LLI1(rows_number): return [LI1() for _ in range(rows_number)] def BI(): return sys.stdin.buffer.readline().rstrip() def SI(): return sys.stdin.buffer.readline().rstrip().decode() inf = 10 ** 16 md = 10 ** 9 + 7 # md = 998244353 h, w, n, m = LI() ss = LLI(n) cs = [[0] * (w + 1) for _ in range(h + 1)] for _ in range(m): x, y, b, c = LI() i0 = max(1,x - b) i1 = min(h,x + b + 1) j0 = max(1,y - b) j1 = min(w,y + b + 1) cs[i0][j0] += c cs[i1][j1] += c cs[i0][j1] -= c cs[i1][j0] -= c for i in range(1, h + 1): for j in range(w): cs[i][j + 1] += cs[i][j] for j in range(1, w + 1): for i in range(h): cs[i + 1][j] += cs[i][j] for i in range(1, h + 1): for j in range(w): cs[i][j + 1] += cs[i][j] for j in range(1, w + 1): for i in range(h): cs[i + 1][j] += cs[i][j] # p2D(cs) ans = 0 for t, u, l, r, a in ss: t, l = t - 1, l - 1 # print(cs[t][l] + cs[u][r] - cs[t][r] - cs[u][l]) if cs[t][l] + cs[u][r] - cs[t][r] - cs[u][l] < a: ans += 1 print(ans)