""" 爆風だけ考える """ import sys from sys import stdin import math H,W,N,M = map(int,stdin.readline().split()) lis = [[0] * (W+2) for i in range(H+2)] TULRA = [] for i in range(N): T,U,L,R,A = map(int,stdin.readline().split()) TULRA.append( (T,U,L,R,A) ) for i in range(M): X,Y,B,C = map(int,stdin.readline().split()) XA = max(0,X-B) YA = max(0,Y-B) XB = min(H+1, X+B+1) YB = min(W+1, Y+B+1) lis[XA][YA] += C lis[XA][YB] -= C lis[XB][YA] -= C lis[YA][YB] -= C for i in range(H+2): for j in range(W+1): lis[i][j+1] += lis[i][j] for j in range(W+2): for i in range(H+1): lis[i+1][j] += lis[i][j] for i in range(H+2): for j in range(W+1): lis[i][j+1] += lis[i][j] for j in range(W+2): for i in range(H+1): lis[i+1][j] += lis[i][j] #print (lis) ans = 0 for T,U,L,R,A in TULRA: L -= 1 T -= 1 now = lis[U][R] - lis[T][R] - lis[U][L] + lis[T][L] #print (now) if now < A: ans += 1 print (ans)